Hello,
I’m new to aspose slide. I’m able to generate pptx file using aspose slide product. I’m facing an issue since 1 month of setting table width and position on slide dynamically by code(.NET). I couldn’t found syntax for setting width and positioning through code can you please help me to solve out.
If anyone can provide syntax for setting width of table and table cells than that would be great.
Thanks.
Hi Jonathan,
double[] dblCols = { 30, 30, 30, 30, 30, 30, 30 };
double[] dblRows = { 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20 };
//Add table shape to slide
ITable tbl = slide.Shapes.AddTable(100, 50, dblCols, dblRows);
Where 30 is the width of each column, 20 is the height of each row; 100 and 50 are the x,y coordinates of top left corner of the table.
Also, I request you to please visit this link for your kind reference.
I hope this clarifies the concept. Please share if I may help you further in this regard.
Best Regards,
Thanks for the reply Adnan,
As you suggested, I did the same and I am able to achieve my goal. but I don’t want to add table from code. I just want to fetch table from slide and want to change height, width of cells as per the text that I want to add in cell and position of existing table in slide.
e.g. If my cell text is “New” then want to set height,width of cell according to it and if my cell text is “New Accomodation” then want to set height,width of cell accordingly.
Note: I am using Aspose.slides version(v. 15.1.0.0)
Thanks.
Hi Jonathan,
Thanks Adnan for the quick response.
Hi Jonathan,
Hi Adnan,
Hi Jonathan,
iTable.setWidth(380); does not change the width of shape/table