Get Table cells coordinates and arrows drawing

Hi!

1)
I have Table with some rows and cells/
I need draw line from some cell to any coordinates.
Can I nake it with this tool?

2) Can I draw not simple line but arrow?

Hello Mike,

Thanks for considering Aspose.

You can add a Graph object inside a table cell, because as per the DOM for Aspose PDF for .NET, a table cell contains a paragraph. Graph objects are referred to as Paragraphs in the DOM. However, adding an arrow is currently not supported by Aspose.Pdf for .NET. You can add other simple objects such as Lines, Curves, Ellipses, etc. Visit this link for more information on Working with Graphs.

For your convenience, we have decided to support the feature of adding arrows using a Graph object. I have logged this new feature as PDFNET-12094 in our issue tracking system. We will investigate this requirement in detail and keep you updated on the status of implementation.

We apologize for any inconvenience caused.

Hi Nayyer, thank you for response. I made next code but
cell.Paragraphs[0].Left and cell.Paragraphs[0].Top always = -1.0 and -1.0.
May be my solution is wrong?
I need draw line from cell border to any point on page.

for (int i = 0; i < rowCount; i++)
{
Row row = tab1.Rows.Add();
for (int y = 0; y < colCount; y++)

{
Cell cell = row.Cells.Add("[" + i + “,” + y + “]”);

Paragraph paragraph = new Graph();

cell.Paragraphs.Add(paragraph);

}
}

foreach (Row row in table.Rows)
{
foreach (Cell cell in row.Cells)
{
Line line = new Line(new float[] { 100, 100, cell.Paragraphs[0].Left, cell.Paragraphs[0].Top});
graph.Shapes.Add(line);

}
}

Hello Mike,

Thanks for considering Aspose.

Please try using the following code snippet to accomplish your requirement. I've also attached the resultant PDF document for your reference.

[C#]

Pdf pdf = new Pdf();
Aspose.Pdf.Section sec1 = pdf.Sections.Add();
//Instantiate a table object
Table tab1 = new Table();
//Add the table in paragraphs collection of the desired section
sec1.Paragraphs.Add(tab1);

//Set with column widths of the table
tab1.ColumnWidths = "50 50 50";
//Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 0.1F);
//Set table border using another customized BorderInfo object
tab1.Border = new BorderInfo((int)BorderSide.All, 1F);

//Create MarginInfo object and set its left, bottom, right and top margins
MarginInfo margin = new MarginInfo();
margin.Top = 5f;
margin.Left = 5f;
margin.Right = 5f;
margin.Bottom = 5f;
//Set the default cell padding to the MarginInfo object
tab1.DefaultCellPadding = margin;
//Create rows in the table and then cells in the rows
Row row1 = tab1.Rows.Add();
row1.Cells.Add("col1");
row1.Cells.Add("col2");
row1.Cells.Add("col3");
Row row2 = tab1.Rows.Add();
row2.Cells.Add("item1");
row2.Cells.Add("item2");
row2.Cells.Add("item3");

Graph graph1 = new Graph(sec1, 100,50);
row2.Cells[2].Paragraphs.Add(graph1);

float[] posArr = new float[] { 0,0, 100, 100};
Line l1 = new Line(graph1, posArr);
l1.GraphInfo.Color = new Aspose.Pdf.Color("Red");
graph1.Shapes.Add(l1);

pdf.Save(@"d:/pdftest/CellGraphDrawing.pdf");

In case it does not resolve your problem or you've any further query, please feel free to contact.

thank you for detailed answer