Hi,
I have a Table binding in PPT page2.
I want to continue in page 3 if table rows are exceeding page 2.
Thanks in advance for your support.
Here is my code.
DataTable dt = new DataTable();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Rows.Add("Heading 1", "Heading 2", "Heading 3", "Heading 4";
for (int i = 0; i < list.Count; i++)
{
list[i].WP = list[i].WP.Replace(Environment.NewLine, String.Empty).Replace(" ", String.Empty);
list[i].ED = list[i].ED.Replace(Environment.NewLine, String.Empty).Replace(" ", String.Empty);
list[i].EE = list[i].EE.Replace(Environment.NewLine, String.Empty).Replace(" ", String.Empty);
dt.Rows.Add(list[i].WP, list[i].ED, list[i].EE, "");
}
//set table widths and heights
double[] widths = new double[dt.Columns.Count];
double[] heights = new double[dt.Rows.Count];
for (int i = 0; i < widths.Length; i++)
{
if (i == 0)
{
widths[i] = 70;
}
else if (i == 1)
{
widths[i] = 300;
}
else if (i == 2)
{
widths[i] = 300;
}
else{
widths[i] = 50;
}
//widths[i] = 100;
}
for (int i = 0; i < heights.Length; i++)
{
heights[i] = 15;
}
//Adding created table to ppt
ITable table = ppt.Slides[1].Shapes.AppendTable(ppt.SlideSize.Size.Width /2 - 370, 155, widths, heights);
//set the style of table
table.StylePreset = TableStylePreset.LightStyle1Accent2;
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
//Fil the table with data
table[j,i].TextFrame.Text = dt.Rows[i][j].ToString();
//Set the font
table[j,i].TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial");
table[j,i].TextFrame.Paragraphs[0].TextRanges[0].FontHeight = 10f;
table[j, i].TextFrame.Paragraphs[0].TextRanges[0].Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
table[j, i].TextFrame.Paragraphs[0].TextRanges[0].Fill.SolidColor.Color = Color.FromArgb(255,0,0);
}
}
//Set the alignment of the first row to Center
for (int i = 0; i < dt.Columns.Count; i++)
{
table[i,0].TextFrame.Paragraphs[0].Alignment = TextAlignmentType.Center;
}