[FEATURE REQUEST] spreadsheet zoom
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
[FEATURE REQUEST] spreadsheet zoom
I often wish I could shrink a spreadsheet, to get more on screen. Is there a way?
[Edit: I have created a feature request in the Bug Tracker, at Kunda1's request]
https://tracker.freecadweb.org/view.php?id=4410
[Edit: I have created a feature request in the Bug Tracker, at Kunda1's request]
https://tracker.freecadweb.org/view.php?id=4410
Last edited by TomB19 on Sat Jul 25, 2020 6:47 pm, edited 3 times in total.
-
- Veteran
- Posts: 4873
- Joined: Thu Apr 05, 2018 1:53 am
Re: Is there a way to zoom a spreadsheet view?
There is a way to shrink the row height via python.
After running this in the python console, right click the document name in the tree and select Mark to recompute, then F5 to recompute.
Code: Select all
for ii in range(1,99):
App.ActiveDocument.Spreadsheet.setRowHeight('A'+str(ii),1)
Re: Is there a way to zoom a spreadsheet view?
Would it merit a feature request to have a slider of a sort somewhere at the bottom of the spreadsheet dialog that scales the size of the spreadsheet ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Veteran
- Posts: 4873
- Joined: Thu Apr 05, 2018 1:53 am
Re: Is there a way to zoom a spreadsheet view?
I don't know. You can already adjust the row sizes individually. In the image below the red circle indicates the drag point.
Re: Is there a way to zoom a spreadsheet view?
Thank you, TheMarkster.
For a few months, I was adding attributes to spreadsheets in a two column format. That would have been helpful, then.
That approach proved nonviable so I switched to a multi-column format. This has helped a lot.
I've attached a screen shot of the layout I use, these days. It's blurry because it's been heavily shrunk for forum upload (native 2560x1600 resolution).
Sometimes it would be nice to be able to control the size of the entire spreadsheet, something like the LibreCalc zoom slider at the bottom right (screen shot below, for those who haven't seen LibreCalc
).
I doubt this feature is more important than any number of other things the team is working on, so I don't wish to request it.
LibreCalc

For a few months, I was adding attributes to spreadsheets in a two column format. That would have been helpful, then.
That approach proved nonviable so I switched to a multi-column format. This has helped a lot.
I've attached a screen shot of the layout I use, these days. It's blurry because it's been heavily shrunk for forum upload (native 2560x1600 resolution).
Sometimes it would be nice to be able to control the size of the entire spreadsheet, something like the LibreCalc zoom slider at the bottom right (screen shot below, for those who haven't seen LibreCalc

I doubt this feature is more important than any number of other things the team is working on, so I don't wish to request it.
LibreCalc
Re: Is there a way to zoom a spreadsheet view?
Yes, I was thinking of a slider like this one. I think it would be a nice UI/UX addition. For sure low priority but still good to have on the list
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Is there a way to zoom a spreadsheet view?
I'd imagine the need to use https://doc.qt.io/qt-5/qslider.html
Do you mind making a gif or screencast of the slider in action and posting to this thread ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Is there a way to zoom a spreadsheet view?
hi
modify only the colon A to Z
and the row 1 to 50
for modify the text size .. ??? .. other gourou Python
mario
adaptation of the macro openBrain and awei adding extra info in statusbar
modify only the colon A to Z
and the row 1 to 50
for modify the text size .. ??? .. other gourou Python
Code: Select all
#################################################
##https://forum.freecadweb.org/viewtopic.php?f=22&t=48217#p413246
##12/07/2020
##mario52
##https://forum.freecadweb.org/viewtopic.php?f=22&t=48217#p413246
##worked and based on the openBrain and awei snippet
##
#
import PySide2
from PySide2 import QtWidgets
import FreeCAD
def sliderVal(value):
try:
for i in range(26): # for 26 colon A .. to .. Z
for ii in range(1, 50 + 1): # for 50 row 1 .. to .. 50
#print(chr(i+65)+str(ii))
cellule = chr(i+65)+str(ii)
App.ActiveDocument.Spreadsheet.setRowHeight(cellule, value)
App.ActiveDocument.Spreadsheet.setColumnWidth(cellule, value * 4)
App.ActiveDocument.Spreadsheet.touch()
App.activeDocument().recompute()
except Exception:
None
pb = PySide2.QtWidgets.QSlider()
pb.setOrientation(PySide2.QtCore.Qt.Horizontal)
pb.valueChanged.connect(sliderVal)
Gui.getMainWindow().statusBar().addWidget(pb)
pb.show()
###################################################
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Is there a way to zoom a spreadsheet view?

This is awesome!
Yes! We need another python guru to chime in here for sure.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Veteran
- Posts: 4873
- Joined: Thu Apr 05, 2018 1:53 am
Re: Is there a way to zoom a spreadsheet view?
A few modifications to Mario's macro.
Changes:
1) only change row heights
2) get preselected cells and apply row height to only those rows
3) set minimum to 1 (0 hides row entirely) and maximum to 200
4) allow for operation on selected spreadsheet (but it must be selected in the tree, not just in the sheet view)
Things to do:
1) add/show the slider only when the sheet view is active (unless it already exists), then hide/remove it
2) incorporate somehow into FreeCAD main (maybe modify src/Mod/Spreadsheet/InitGui.py?)
Code: Select all
#################################################
##https://forum.freecadweb.org/viewtopic.php?f=22&t=48217#p413246
##12/07/2020
##mario52
##https://forum.freecadweb.org/viewtopic.php?f=22&t=48217#p413246
##worked and based on the openBrain and awei snippet
##
#
import PySide2
from PySide2 import QtWidgets
import FreeCAD
sheet = None
def getSelected():
"""returns a QModelIndex object or None if none are selected
use [0] to get at first cell in the selection
use [0].row() to get first cell's row
use [0].column() to get first cell's column
use [-1] to get last cell in the selection
"""
global sheet
from PySide import QtGui
mw=FreeCADGui.getMainWindow()
mdiarea=mw.findChild(QtGui.QMdiArea)
subw=mdiarea.subWindowList()
sel = Gui.Selection.getSelection()
name=""
if sel:
name = sel[0].Name
for i in subw:
if i.widget().metaObject().className() == "SpreadsheetGui::SheetView":
if not name == i.windowTitle().replace('[*]',''):
continue
sheet=Gui.Selection.getSelection()[0]
return i.widget().findChild(QtGui.QTableView).selectedIndexes()
return None
def sliderVal(value):
try:
ranges = getSelected()
if not sheet:
return
for rr in ranges:
cellule = chr(rr.column()+65)+str(rr.row()+1)
sheet.setRowHeight(cellule,value)
sheet.touch()
App.activeDocument().recompute()
except Exception:
None
pb = PySide2.QtWidgets.QSlider()
pb.setMinimum(1)
pb.setMaximum(200)
pb.setOrientation(PySide2.QtCore.Qt.Horizontal)
pb.valueChanged.connect(sliderVal)
Gui.getMainWindow().statusBar().addWidget(pb)
pb.show()
###################################################
1) only change row heights
2) get preselected cells and apply row height to only those rows
3) set minimum to 1 (0 hides row entirely) and maximum to 200
4) allow for operation on selected spreadsheet (but it must be selected in the tree, not just in the sheet view)
Things to do:
1) add/show the slider only when the sheet view is active (unless it already exists), then hide/remove it
2) incorporate somehow into FreeCAD main (maybe modify src/Mod/Spreadsheet/InitGui.py?)