cart: empty [ Login ]

Displaying vector images inside a table cell

1 
kaczvic
10/20/2021 8:57 AM

Hello Wout, we're an electro engineering company evaluating your CADLIB 4.0. We need to display images (preferred vector formatted like *.svg) inside a table cell. Is this possible? Cheers, Victor

Wout
10/20/2021 11:49 AM

Hi Victor, That's not possible I'm afraid. You can display an image (bitmap) or a block. - Wout

kaczvic
10/20/2021 12:13 PM

Hi Wout, thanks for your fast reply. I'm afraid to hear this. Could you please provide us an short example on how to insert an image inside a cell? Following your documentation the table looks like this right now. Thank you very much.

C# Code:
//******************************* //* * * * * //* ************************** //* * * * * //******************************* table.Rows[0].Cells[0].Contents.Add(new DxfValueFormat.String(), "Header"); table.Rows[1].Cells[0].Contents.Add(new DxfValueFormat.String(), "ICON"); table.Rows[1].Cells[1].Contents.Add(new DxfValueFormat.String(), "TEXT11"); table.Rows[1].Cells[2].Contents.Add(new DxfValueFormat.String(), "TEXT12"); table.Rows[1].Cells[3].Contents.Add(new DxfValueFormat.String(), "TEXT13"); table.Rows[2].Cells[1].Contents.Add(new DxfValueFormat.String(), "TEXT21"); table.Rows[2].Cells[2].Contents.Add(new DxfValueFormat.String(), "TEXT22"); table.Rows[2].Cells[3].Contents.Add(new DxfValueFormat.String(), "TEXT23"); table.Rows[3].Cells[0].Contents.Add(new DxfValueFormat.String(), "Footer"); // Header table.MergedCellRanges.Add(new DxfTableCellRange(0, 0, 0, 2)); //Icon left table.MergedCellRanges.Add(new DxfTableCellRange(1, 0, 2, 0)); //FOOTER table.MergedCellRanges.Add(new DxfTableCellRange(3, 0, 3, 3)); model.Entities.Add(table);

Wout
10/20/2021 12:26 PM

Here's how to add a block in a table cell:

C# Code:
public void TestTableWithBlocks() { DxfModel model = new DxfModel(DxfVersion.Dxf21); DxfTableStyle tableStyle = new DxfTableStyle("Double bordered"); tableStyle.DataCellStyle.SetAllBordersBorderType(BorderType.Double); tableStyle.DataCellStyle.SetAllBordersColor(Colors.Green); tableStyle.TitleCellStyle.SetAllBordersBorderType(BorderType.Double); tableStyle.HeaderCellStyle.SetAllBordersBorderType(BorderType.Double); model.TableStyles.Add(tableStyle); DxfBlock block = new DxfBlock("TESTBLOCK"); model.Blocks.Add(block); block.Entities.Add( new DxfLwPolyline( new Point2D(2d, 1d), new Point2D(2d, 3d), new Point2D(5d, 3d), new Point2D(6d, 2d), new Point2D(5d, 1d) ) ); block.Entities.Add(new DxfCircle(new Point3D(5d, 3d, 0d), 2d)); { DxfTable table = new DxfTable(model.DefaultTableStyle); table.InsertionPoint = new Point3D(0d, 10d, 0d); table.TableStyle = tableStyle; table.RowCount = 4; table.ColumnCount = 1; foreach (DxfTableColumn column in table.Columns) { column.Width = 8d; } table.Rows[0].Cells[0].Contents.Add(new DxfValueFormat.String(), "Text"); table.Rows[1].Cells[0].Contents.Add(new DxfTableCellContent(block)); table.Rows[2].Cells[0].Contents.Add(new DxfTableCellContent(block)); table.Rows[2].Cells[0].Contents[0].Format.AutoScale = true; table.Rows[2].Cells[0].CellStyleOverrides.CellAlignment = CellAlignment.MiddleCenter; table.Rows[3].Cells[0].Contents.Add(new DxfTableCellContent(block)); table.Rows[3].Cells[0].Contents[0].Format.BlockScale = 0.5d; table.Rows[3].Cells[0].CellStyleOverrides.CellAlignment = CellAlignment.BottomRight; model.Entities.Add(table); } DwgWriter.Write("TableWriteTest.TestTableWithBlocks.dwg", model); }
For creating an image entity, see example in the DxfRasterImage the documentation. Edit: you should then add the image to the block ofcourse. - Wout

1