Class CadTableEditor
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
Cut, Copy, Paste, Match Cell, Locking, Data Format, and Insert Block, Field and Formula of the cells of a table, as the Table Cell tab and the right-click menu of AutoCAD 2021 make them; each edit one undo step, "TABLEDIT". A cell locked (DxfCellState) in its content refuses to be typed into, emptied, cut, pasted over or given a block, field or formula; one locked in its format refuses its alignment, fill, borders, data format and paste.
public static class CadTableEditor
- Inheritance
-
CadTableEditor
- Inherited Members
Remarks
The schedule of a title, a header and four rows of five columns, given a row below its row 3, has seven rows, the new one of the look of row 3 and empty; its cells B3 to C4 merged read as one cell, its text that of B3.
Methods
- CellName(int, int)
Gets the name AutoCAD gives a cell: its column's letters and its row's number from 1, as C3 for the row 2 and the column 2.
- CellNear(DxfTable, GeoPoint2, out int, out int)
Gets the cell of a table nearest a point of the plan: the cell it falls in, or where it falls outside the table, the cell of the last row or column on that side, as a drag across cells holds the range at the table's edge.
- CellStyleNames(DxfTable)
The names of the cell styles the table style of a table holds, Title, Header and Data first; the three where the table names no style.
- CellStyleOf(DxfTable, int, int)
Gets the name of the cell style a cell takes: that its TABLECONTENT names (Title, Header, Data or a user's), else that of its row (the title, the header or the data), as the Cell Styles box of the tab shows it.
- ClearContents(CadDocument, string, DxfCellRange)
Empties the cells of a range, as Delete and Delete All Contents do: their text or block taken, their look kept.
- ColumnName(int)
Gets the letters AutoCAD gives a column: A to Z, then AA, AB and on.
- Copy(DxfTable, DxfCellRange)
Takes the cells of a range as a snapshot, with their contents and looks: what Copy puts on the clipboard.
- Corners(DxfTable, DxfCellRange)
Gets the corners of a range of cells, the top left first, then about it, in the plan.
- CreateCellStyle(CadDocument, string, string, string)
Makes a cell style of a table style, as Create New Cell Style does: of the name given, starting from the look of one of the style's. One undo step.
- Cut(CadDocument, string, DxfCellRange, out CadTableCellClip)
Cuts the cells of a range, as Cut does: they are copied, then their contents taken out as Delete takes them, their looks and merges kept, in one undo step. Refused where a cell is locked in its content.
- DeleteCellStyle(CadDocument, string, string)
Takes a cell style a user made out of a table style, as Delete does in Manage Cell Styles; Title, Header and Data stay. One undo step.
- DeleteColumns(CadDocument, string, int, int)
Takes out columns, as Delete Column(s) does; refused where no column would be left.
- DeleteRows(CadDocument, string, int, int)
Takes out rows, as Delete Row(s) does; refused where no row would be left.
- Fill(CadDocument, string, DxfCellRange, DxfCellRange, DxfTableFillOptions)
Fills cells from others, as the autofill grip of a cell does: Fill(DxfCellRange, DxfCellRange, DxfTableFillOptions) in one undo step, "Autofill". A 1 in A3 filled down into A4 to A6 with GenerateSeries and CopyFormat, as Fill Series fills, gives 2, 3 and 4, as AutoCAD 2021 filled them.
- Grown(DxfTable, DxfCellRange)
Gives a range of cells grown to take in every block of merged cells it meets, as a selection of cells takes them.
- InsertBlock(CadDocument, string, int, int, string, double, bool, double, DxfCellAlignment?)
Puts a block into a cell, as the Insert a Block in a Table Cell dialog does: the cell a block cell of the block, fitted to the cell (AutoFit) or at the scale given, turned, and its content aligned as given, one undo step. A block cell given another block keeps its scale and turn unless the dialog asks again.
- InsertColumn(CadDocument, string, int, bool)
Puts in a column left or right of a column, of its look, as Insert Left and Insert Right do.
- InsertField(CadDocument, string, int, int, string)
Puts a field into a cell, as Insert Field does with the Field dialog's code: the cell shows the words the field comes to, and keeps the field to evaluate again, one undo step.
- InsertFormula(CadDocument, string, int, int, string)
Puts a formula into a cell, as Insert Formula does:
=Sum(A1:B3),=Average(C2:C9),=Count(A1:A5), a cell=B2or an equation=A1*B1+2; the cell shows what the formula comes to, and every formula of the table is worked out again after each edit, one undo step. A formula that cannot be worked out (a cell of words in it, a division by nought) shows#####.
- InsertRow(CadDocument, string, int, bool)
Puts in a row above or below a row, of its look, as Insert Above and Insert Below do.
- MatchCell(CadDocument, string, int, int, string, DxfCellRange)
Matches cells to another, as Match Cell does: the look of the source cell (its alignment, text height, style and colour, fill, borders and data format) given each cell of the range, their contents kept; one undo step.
- Merge(CadDocument, string, DxfCellRange)
Merges the cells of a range into one, as Merge All does: its text that of its top left cell.
- MinimumColumnWidth(DxfTable, int)
Gets the least width a column of a table may be dragged to, as AutoCAD 2021's
MinimumColumnWidth: its two horizontal margins and the tallest text height of its cells, or where a block cell starts in it that is not fitted to its cell, the width its block's extents fill at the cell's scale and turn with the two margins, if that is more. AutoCAD's Standard of margins 1.5 and a title of 6 gives 9, and a block 30 wide 33 (63 at scale 2, 31.28427 turned 45 degrees); a block merged across columns asks the column it starts in alone. The words of an attribute definition in the block are in its extents where the drawing's fonts find them (FontSearchPath).
- Paste(CadDocument, string, DxfCellRange, CadTableCellClip)
Pastes cells at the top left cell of a range, as Paste does: each cell given the content and the look of the one copied (a number with its format, words as they were typed, a block with its scale and attribute values, a field, a formula with its references moved by the rows and columns it moved), the merges within the cells copied made again and those the paste meets taken out. A range of whole multiples of the cells copied is filled with them side by side. What falls past the table's last row or column is left out. One undo step; refused where a cell pasted over is locked.
- RemoveOverrides(CadDocument, string, DxfCellRange)
Takes away what the cells of a range hold of their own over the table style, as Remove All Property Overrides does (RemoveAllOverrides(int, int)): their text, values and merges kept.
- RenameCellStyle(CadDocument, string, string, string)
Renames a cell style a user made, as Rename does in Manage Cell Styles. One undo step.
- SetAlignment(CadDocument, string, DxfCellRange, DxfCellAlignment)
Sets where the content of the cells of a range stands, as the alignment of Cell Styles does.
- SetBackground(CadDocument, string, DxfCellRange, DxfColor)
Fills the cells of a range with a colour, or leaves them unfilled, as the fill of Cell Styles does.
- SetBorders(CadDocument, string, DxfCellRange, DxfGridLineType, bool)
Draws or hides lines of a range of cells, as the border buttons do: All borders, Outside borders, Inside borders, the bottom, left, top or right, or none (AllGridLines hidden).
- SetCellBorders(CadDocument, string, DxfCellRange, DxfGridLineType, bool, DxfLineWeight, DxfColor)
Gives lines of a range of cells properties, as OK of the Cell Border Properties dialog does: the lines (All, Outside, Inside, Bottom, Left, Top or Right, or all of them hidden by No Border) drawn or not, and, where they are drawn, their lineweight and colour; one undo step. A range of one row or column has no lines inside it of that way.
- SetCellStyle(CadDocument, string, DxfCellRange, string)
Gives the cells of a range a cell style, as choosing one in the Cell Styles box does: its look (alignment, text height, text style and colour, fill and the four borders) written as the cells' own overrides over what they held, their contents kept, and its id written into their TABLECONTENT;
nullis By Row/Column: the cells name no style and keep what they hold. One undo step.
- SetColumnWidths(CadDocument, string, int, IReadOnlyList<double>)
Sets the widths of columns, from one on, in one undo step, "Column Width", as a drag of a column's line does; the rows then grow to hold text that wraps anew. A width below MinimumColumnWidth(DxfTable, int) is taken as that, as AutoCAD 2021 holds a column there: columns of 30 and 22.5 given 38 and 14.5 keep the table's width, and one given 1 in AutoCAD's Standard is 9 wide.
- SetDataFormat(CadDocument, string, DxfCellRange, DxfDataType, DxfUnitType, string)
Gives the cells of a range a kind of data and a format, as the Data Format dialog does: the kind (a number, a whole number, words) and its unit (a length, an angle, money, a percentage), then the format, as
%lu2%pr2%ps[$,]%th44for money of two places with a dollar sign and commas; the values kept, shown anew. One undo step.
- SetLocking(CadDocument, string, DxfCellRange, DxfCellState)
Locks or unlocks the cells of a range, as the Cell Locking menu does: Unlocked (None), Content Locked, Format Locked, or Content and Format Locked, one undo step. The flag of a linked cell is kept.
- SetRowHeights(CadDocument, string, int, IReadOnlyList<double>)
Sets the heights of rows, from one on, in one undo step, "Row Height", as a drag of a row's line does; a row is never lower than its text needs, grown back to it as the table is drawn anew.
- SetText(CadDocument, string, int, int, string)
Writes the text of a cell, as typing in it does; the same text changes nothing. A number typed, spaces round it left out, is kept as a number unless the cell is made to hold text, as AutoCAD 2021 reads a text it parses into a value (
ConvertTextToValue): 1 is the whole number 1 and 007 the whole number 7, so that the autofill grip dragged from it counts 2, 3, 4; 1.5 a number shown in the drawing's units, 1.5000 at LUPREC 4, 1e3 one shown 1.0000E+03 and 1/2 one shown 1/2, each standing top right where the cell has no alignment of its own; 1,5 the point (1, 5, 0) shown 1.0000, 5.0000, 0.0000; and a number typed in a cell of a number keeps the cell's kind and format, 12 over 1.25 shown 12.0000. A date or a time, in the order of the culture of the machine, is a date as AutoCAD 2021 reads it: 1/2/2020 or 12:30 of a cell of no kind, shown 1/2/2020 or 12:30:00 PM (the formats%x,%Xand%cfor a date, a time and both), and any other words over a cell of a date are refused. b1 and 12mm stay text.
- StyleOf(DxfTable)
Gets the table style a table is written in; null where the table names none.
- TryCellAt(CadSpace, GeoPoint2, out string, out int, out int)
Gets the table of a space a point of the plan falls in, and its cell, the table appended last first; false where it falls in none.
- TryHit(DxfTable, GeoPoint2, out int, out int)
Gets the cell of a table a point of the plan falls in, seen from above; false where it falls in none.
- Unmerge(CadDocument, string, DxfCellRange)
Unmerges every block of merged cells a range meets, as Unmerge Cells does.