Hi,
There was a bug, it's now fixed, please download the latest CadLib 4.0 version.
Note that you can't set the
, because the property is not used. You can set the
though. See modified sample below:
DxfModel model = new DxfModel(DxfVersion.Dxf21);
DxfTableStyle tableStyle = new DxfTableStyle("Double bordered");
tableStyle.DataCellStyle.SetAllBordersBorderType(BorderType.Double);
tableStyle.DataCellStyle.SetAllBordersColor(Colors.Green);
tableStyle.DataCellStyle.BackColor = Colors.Blue;
tableStyle.TitleCellStyle.SetAllBordersBorderType(BorderType.Double);
tableStyle.TitleCellStyle.BackColor = Colors.Red;
tableStyle.HeaderCellStyle.SetAllBordersBorderType(BorderType.Double);
tableStyle.HeaderCellStyle.ContentColor = Colors.Blue;
tableStyle.HeaderCellStyle.BackColor = Colors.Green;
// Setting the BackColor of the TableCellStyle is not supported.
//tableStyle.TableCellStyle.BackColor = Colors.Red;
model.TableStyles.Add(tableStyle);
DxfTable table = new DxfTable(tableStyle);
table.InsertionPoint = new Point3D(0d, 10d, 0d);
table.RowCount = 6;
table.ColumnCount = 3;
foreach (DxfTableColumn column in table.Columns) {
column.Width = 8d;
}
table.Rows[0].Cells[0].Contents.Add(new DxfValueFormat.String(), "The table title");
table.Rows[1].Cells[0].Contents.Add(new DxfValueFormat.String(), "Column 1 Header");
table.Rows[1].Cells[1].Contents.Add(new DxfValueFormat.String(), "Column 2 Header");
table.Rows[1].Cells[2].Contents.Add(new DxfValueFormat.String(), "Column 3 Header");
table.Rows[2].Cells[0].Contents.Add(new DxfValueFormat.String(), "Text");
table.Rows[2].Cells[0].CellStyleOverrides.BackColor = Colors.Orange;
table.Rows[4].Cells[0].Contents.Add(DxfValueFormat.Date.CreateRegionalLongDateTime(), DateTime.Now);
table.Rows[5].Cells[0].Contents.Add(new DxfValueFormat.DecimalNumber(LinearUnitFormat.Decimal), 123.45d);
// Merge the title row cells.
table.MergedCellRanges.Add(new DxfTableCellRange(0, 0, 0, 2));
// This demonstrates a merged cell block of 3 by 2 cells.
table.MergedCellRanges.Add(new DxfTableCellRange(2, 0, 3, 2));
model.Entities.Add(table);
DxfWriter.Write(@"C:\support\Table Example.dxf", model);
DwgWriter.Write(@"C:\support\Table Example.dwg", model);