We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

IParagraph increase Rows

I am trying to fill the cells starting at a certain position and need the rows to increment. Right now it just keeps adding all items to the same cell instead of jumping to the next row. I have and IParagraph in Presentation that I am trying to increment the row by 1.

5 Replies

LE Loketha Erusappan Syncfusion Team January 17, 2020 02:37 PM UTC

Hi Fernanda,

Thank you for contacting Syncfusion support.

Adding of more items in the cell doesn’t allow you to create a new row automatically instead you have to create a new row and insert the items which you want to present in each row. To insert a new row and insert the items in specified row as per your wish, we suggest you to refer the below link. This link will contain the information about how to create rows in the table and adding of rows.

Creating a table with specified rows:
https://help.syncfusion.com/file-formats/presentation/working-with-tables#create-a-table-by-adding-rows

Inserting rows in the table:
https://help.syncfusion.com/file-formats/presentation/working-with-tables#insert-a-row-in-table

Please let us know if you have any questions.

Regards,
Loketha E
 



FE Fernanda January 17, 2020 05:02 PM UTC

I used inserting a row in the table, but it seems to copy the first row twice. It adds it again in the last row. 


LE Loketha Erusappan Syncfusion Team January 20, 2020 11:04 AM UTC

Hi Fernanda,

Thank you for your update.

Please find below details and use as per your requirement based.

Insert a row in specified index:
Please find the below sample to know more about how to add a row in specified index and modify the content as per your wish.

Sample
Append new row in the table:
Please find below UG documentation link to know more about how to append a new row in the table.

 



FE Fernanda January 22, 2020 01:23 PM UTC

How can I delete the last extra row it is adding?


LE Loketha Erusappan Syncfusion Team January 23, 2020 09:31 AM UTC

Hi Fernanda,

Thank you for your update.

Please find below detail for your query.

To remove the last row from the table, please find below code snippet. If your requirement is to remove the specific row, then it can be removed by mentioned the row index instead of
table.Rows.Count-1 in the below code snippet.

 
//Create a PowerPoint presentation 
IPresentation pptxDoc = Presentation.Create(); 
//Add slide to the presentation 
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); 
//Add a table to the slide 
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200); 
//Initialize index values to add text to table cells 
int rowIndex = 0, colIndex; 
//Iterate row-wise cells and add text to it 
foreach (IRow rows in table.Rows) 
{ 
colIndex = 0; 
foreach (ICell cell in rows.Cells) 
{ 
cell.TextBody.AddParagraph("(" + rowIndex.ToString() + " , " + colIndex.ToString() + ")"); 
colIndex++; 
} 
rowIndex++; 
} 
//Removes the last row from the table. 
table.Rows.Remove(table.Rows[table.Rows.Count-1]); 
//Save the presentation 
pptxDoc.Save("Sample.pptx"); 
//Close the presentation 
pptxDoc.Close(); 
 

Please let us know if you have any questions.

Regards,
Loketha E
 


Loader.
Live Chat Icon For mobile
Up arrow icon