Spreadsheet Workbench/ro

Introduction
Atelierul lucru pentru foi de calcul vă permite să creați și să editați foi de calcul, să efectuați calcule și să preluați date dintr-un model și să exportați datele sale în alte aplicații de calcul tabelar, cum ar fi LibreOffice sau Microsoft Excel.





Tools

 * Spreadsheet_CreateSheet.svg Create sheet: create a new spreadsheet.


 * Spreadsheet_Import.svg Import: import a tab-separated values file into a spreadsheet.
 * Spreadsheet_Export.svg Export: export a tab-separated values file from a spreadsheet.


 * Spreadsheet_MergeCells.svg Merge cells: merge selected cells.
 * Spreadsheet_SplitCell.svg Split cell: split previously merged cells.


 * Spreadsheet_AlignLeft.svg Align left: align the contents of selected cells to the left.
 * Spreadsheet_AlignCenter.svg Align center: align the contents of selected cells to the center horizontally.
 * Spreadsheet_AlignRight.svg Align right: align the contents of selected cells to the right.
 * Spreadsheet_AlignTop.svg Align top: align the contents of selected cells to the top.
 * Spreadsheet_AlignVCenter.svg Align vertical center: align the contents of selected cells to the center vertically.
 * Spreadsheet_AlignBottom.svg Align bottom: top align the contents of selected cells to the bottom.


 * Spreadsheet_StyleBold.svg Style bold: set the contents of selected cells to bold.
 * Spreadsheet_StyleItalic.svg Style italic: set the contents of selected cells to italic.
 * Spreadsheet_StyleUnderline.svg Style underline: set the contents of selected cells to underlined.


 * Spreadsheet_SetAlias.svg Set alias: set the alias for a selected cell.


 * and set the foreground and the background colors of the selected cells.


 * Context-menu of the spreadsheet rows and columns: right-click onto the header of a row or column to insert a new row above or a new column at the left, or to delete the current row/column. You can also select several rows or columns to delete them. You can also select where the the new rows/columns will be inserted. Furthermore, to insert for example 3 new columns at once, select 3 columns and use the context-menu that will now offer to insert 3 columns.

Spreadsheet editing
As noted above under Tools, right click on a row or column header produces a pulldown menu that allows you to delete the row/column or insert a new blank one. Formula references to cells that get moved by these operations get patched to refer to the new location.

Cut/copy/paste can be used to edit data. Cut and copy will both operate on single cells, rectangles, or indeed any selection group of cells you set up. Cut clears the content of selected cells; both cut and copy store the cell's content and properties in the Clipboard. A paste operation writes the buffered data in such a way that the content of the uppermost-leftmost cell of the buffered set is dropped in the cell where the cursor is when you paste; other buffered content is dropped where it will have the same relationship to that target as it originally did to the upper-left cell of your cut/paste set.

An important caveat: Cut/copy/paste operations do not fix up formula references. If you move the content of a cell, formulas which referred to the old location will break. If the old location becomes empty, the breakage will become visible as the expression evaluator will display #ERR in dependent cells.

Proprietățile celulei
Proprietățile unei celule de calcul tabelar pot fi editate cu un clic dreapta pe o celulă. Următoarele dialoguri apar:



Are câteva tab-uri. Următoarele proprietăți pot fi modificate:


 * Culoarea textului și culoarea de fundal
 * Aliniere text orizontală și verticală
 * Stil text: bold, italic, subliniat
 * Unitate de afișare pentru această celulă. Citiți secțiunea de mai jos.
 * Definiți un nume alias pentru această celulă. Acest alias-nume poate fi folosit în formulele de celule și, de asemenea, în FreeCADExpressions

Cell expressions
A spreadsheet cell may contain arbitrary text or an expression. Technically, expressions must start with an equals '=' sign. However, the spreadsheet attempts to be intelligent; if you enter what looks like an expression without the leading '=', one will be added automatically.

Cell expressions may contain numbers, functions, references to other cells, and references to properties of the model (But see Current limitations below). Cells are referenced by their column (CAPITAL letter) and row (number). A cell may also be referenced by its alias-name (below). Example: B4 + A6

Note: Cell expressions are treated by FreeCAD as programming code. Therefore, when you edit a cell the content you see that it is not following your display settings:
 * the decimal separator is always a dot
 * the number of displayed decimals can differ from your preferences settings

References to objects in the model are explained under References to CAD-data below. Using spreadsheet cell values to define model properties are explained under Spreadsheet data in expressions below. For more information on expressions and the available functions, see Expressions.

Interaction between spreadsheets and the CAD model
Data in the cells of a spreadsheet may be used in CAD model parameter expressions. Thus, a spreadsheet may be used as the source for parameter values used throughout a model, effectively gathering the values in one place. When values are changed in the spreadsheet, they are propagated throughout the model.

Similarly, properties from CAD model objects may be used in expressions in spreadsheet cells. This allows use of object properties like volume or area in the spreadsheet. If the name of an object in the CAD model is changed, the change will automatically be propagated to any references in spreadsheet expressions using the name which was changed.

More than one spreadsheet may be used in a document. A spreadsheet can be identified using either its name or its label.

FreeCAD will automatically assign a unique name to a spreadsheet when it is created. These names follow the pattern, , and so on. The name can not be changed manually, and it is not visible in the properties of the spreadsheet. It can be used to refer to the spreadsheet in an Expression (see Spreadsheet data in expressions below.)

The label of a spreadsheet is automatically set to the name of the spreadsheet upon creation. Unlike the name, the label can be changed, for example in the properties panel or using the context menu action Rename. Note that the label of a spreadsheet within a document has to be unique; if you try to change the label to a label already used by another spreadsheet, FreeCAD will not accept the new label.

FreeCAD checks for cyclic dependencies. See Current limitations.

Referință To CAD-Data
Este posibil să utilizați datele din construcție în foaia de calcul. Următorul tabel prezintă câteva exemple, presupunând că modelul are o caracteristică numită "Cube" (rețineți că acesta este numele intern al caracteristicii, și nu numele utilizatorului atribuit etichetei):

Computed expressions in spreadsheet cells start with an equals ('=') sign. However, the spreadsheet entry mechanism attempts to be smart. An expression may be entered without the leading '='; if the string entered is a valid expression, an '=' is automatically added when the final is typed. If the string entered is not a valid expression (often the result of entering something with the wrong case, e.g. "MyCube.length" instead of "MyCube.Length"), no leading '=' is added and it is treated as simply a text string.

Note: The above behavior (auto insert of '=') has some unpleasant ramifications:
 * If you want to keep a column of names corresponding to the alias-names in an adjacent column of values, you must enter the name in the label column before giving the cell in the value column its alias-name. Otherwise, when you enter the alias-name in the label column the spreadsheet will assume it is an expression and change it to "="; and the displayed text will be the value from the  cell.
 * If you make an error when entering the name in the label column and wish to correct it, you cannot simply change it to the alias-name. Instead, you must first change the alias-name to something else, then fix the text name in the label column, then change the alias-name in the value column back to its original.

One way to side-step these issues is to prefix text labels corresponding to alias-names with a fixed string, thereby making them different. Note that "_" will not work, as it is converted to "=". However, a blank, while invisible, will work.

The following table shows some examples assuming the model has a feature named "MyCube":

Spreadsheet Data în Expresii
In order to use spreadsheet data in other parts of FreeCAD, you will usually create an Expression that refers to the spreadsheet and the cell that contains the data you want to use. You can identify spreadsheets by name or by label, and you can identify the cells by position or by alias. Autocompletion is available for all forms of referencing.

The recommended way to refer to spreadsheet data is to use the spreadsheet label and cell alias name. For a more in-depth explanation of the pros and cons of the addressing modes, see the expanded section below.

Using the spreadsheet label has the advantage that it can be freely changed to describe the contents of the spreadsheet. It is also easier to identify the spreadsheet that is being used since the text in the expression matches the label shown in the model and property views. If you decide to change the label of a spreadsheet, existing references to the contents of the spreadsheet will be updated, so you won't break your expressions by renaming the spreadsheet. The internal name of the spreadsheet is not readily available anywhere except within the expression editor, so if you use the internal name and later decide to rename the spreadsheets, you might have a hard time tracing your expression data back to its source.

Be aware that when you create a new spreadsheet, the name and the label are the same, so it is easy to accidentally use the spreadsheet name instead of the label. A simple way to avoid this is to give the spreadsheet a meaningful name before starting to use it in expressions.

While you may use the row and column number in an expression to reference a cell, best practice is to give the cell an alias name and use that. See Cell Properties above on how to set the alias. For example, if the data in cell B1 contained the length parameter for an object, an alias name of would allow the value to be referred to as  instead of. Besides being much easier to read and understand, alias names are also much easier to change if you decide to adjust the structure of your spreadsheet. Using an alias also has the advantage that it is reasier to see which cells are used to control other parts of the document. Note that FreeCAD will automatically adjust the positional references in expressions if you insert or remove rows and columns in the spreadsheet, so even if you use row and column numbers in an expression, you can insert rows and columns without breaking the references to the surrounding cells.

Complex models and recomputes
Editing a spreadsheet will trigger a recompute of the 3D model, even if the changes do not affect the model. For a complex model a recompute can take a long time, and having to wait after every single edit is of course quite annoying.

There are three solutions to deal with this:
 * 1) Temporarily skip recomputes:
 * 2) * In the Tree view right-click the [[Image:Document.svg|24px]] document that contains the spreadsheet.
 * 3) * Select the option from the context menu.
 * 4) * There is a big disadvantage to this solution. New values entered in the spreadsheet will not be displayed until the document is recomputed. Instead is shown.
 * 5) * You can either recompute manually, using the Std Refresh command, or disable when you are done editing.
 * 6) Use a macro to automatically skip recomputes while editing a spreadsheet:
 * 7) * Download and run skipSheet.FCMacro.
 * 8) * This solution saves a few steps compared to the first solution, but also has the mentioned disadvantage.
 * 9) Put the spreadsheet in a separate FreeCAD file:
 * 10) * You can reference spreadsheet data from an external file with this syntax:.
 * 11) * The advantage of having the spreadsheet in another file over switching off recomputes is that the spreadsheet itself does get recomputed.
 * 12) * The disadvantage is that the model won't automatically recompute after changes to the spreadsheet.
 * 13) * In the scenario where you first open the 'spreadsheet' file, change one or more values and then open the 'model' file, there won't be any indication that the model needs to be recomputed. But if both files are open the Std Refresh icon will update correctly for the 'model' file after changes to the 'spreadsheet' file.

Unități de măsură
Foaia de calcul utilizează unități. Dacă un număr are o unitate, această unitate va fi utilizată în toate calculele. Înmulțirea a două lungimi cu unitatea în mm dă o suprafață cu unitatea mm pătrați-mm & sup2 ;.

If a cell contains a value which represents a dimension, it should be entered with its associated unit. While in many simple cases one can get by with a dimensionless value, it is unwise to not enter the unit. If a value representing a dimension is entered without its associated unit, there are some sequences of operations which cause FreeCAD to complain of incompatible units in an expression when it appears the expression should be valid. (This may be better understood by viewing this thread in the FreeCAD forums.)

Puteți schimba unitatea de lungime de la mm la inch prin dialog, veți obține cu un clic dreapta pe o celulă. Celula va arăta acum lungimea în centimetri. Valoarea utilizată pentru calcule nu se modifică. Rezultatele unei formule care utilizează această valoare nu se modifică atunci când unitatea indicată a unei intrări a fost modificată. Rezultatul se calculează încă din lungimea în mm.

Un număr fără o unitate de măsură nu poate fi modificat într-un număr cu unitate de măsură prin dialogul proprietăților celulare. Se poate introduce un șir de unități, care va fi afișat, dar celula conține încă un număr fără unitate de măsură.

Uneori este de dorit să scapi de o unitate. Acest lucru se poate face numai prin înmulțirea cu 1 cu o unitate reciprocă.

Import și export
Foiile de calcul pot fi importate și exportate în formatul csv, care poate fi, de asemenea, citit și scris de majoritatea altor aplicații de calcul tabelar, cum ar fi Microsoft Excel sau LibreOffice Calc. Când importați fișiere în FreeCAD, separatorul/delimitatorul (caracterul care este utilizat pentru a separa coloanele) trebuie să fie caracterul TAB (acest lucru poate fi setat când exportați din alte aplicații). Importul unui fișier CSV este disponibil prin intermediul foii de calcul Spreadsheet / Import sau prin apăsarea pe pictograma. Această funcție de import nu deschide fișiere Excel sau orice alt format de foaie de calcul.

Foile de calcul în format Excel "xlsx" pot fi importate prin meniul File / Import ... într-un document FreeCAD. Foile de calcul Excel pot fi deschise de FreeCAD făcând clic pe meniul File / Open ... sau făcând clic pe pictograma. În acest caz se creează un nou document cu o foaie de calcul în interior. Sunt acceptate următoarele caracteristici:


 * toate funcțiile disponibile și în foaia de calcul FreeCAD. Alte funcții dau o eroare în celula corespunzătoare după import.
 * Alias nume pentru celule
 * Mai mult de un tabel din foaia Excel. În acest caz, sunt create mai multe foi de calcul FreeCAD.

Alte funcționalități nu sunt importate în foaia de calcul FreeCAD. Importul Excel este al FreeCAD.

Printing
To handle the page setup necessary for printing, FreeCAD spreadsheets are printed by inserting them into a TechDraw Spreadsheet View.

Limitări curente
Nu este posibilă furnizarea de date pentru o geometrie, de exemplu o lungime, într-o foaie de calcul și extragerea în aceeași foaie de calcul a volumului forma rezultată. Aceasta va crea o referință circulară. Aceasta este o decizie de proiectare. Cu toate acestea, este posibil să utilizați două foi de calcul diferite: una ca sursă de date pentru geometrie și altul pentru raportarea datelor geometrice.