Hello there,
Hi Nasser,
Hello Mudassir,
Hi Nasseer,
I like to share that there is no issue while setting the font color. The issue that you are only setting the color but not defining the FillType. You need to first set the FillType then the color. Please try using the following sample code to serve the purpose.
public static void FormatTableText()
{
String path = @“D:\Aspose Data”;
using (Presentation pres = new Presentation())
{
//Access first slide
ISlide sld = pres.Slides[0];
//Define columns with widths and rows with heights
double[] dblCols = { 50, 50, 50 };
double[] dblRows = { 50, 30, 30, 30, 30 };
//Add table shape to slide
ITable tbl = sld.Shapes.AddTable(100, 50, dblCols, dblRows);
//Set border format for each cell
foreach (IRow row in tbl.Rows)
foreach (ICell cell in row)
{
cell.BorderTop.FillFormat.FillType = FillType.Solid;
cell.BorderTop.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderTop.Width = 5;
cell.BorderBottom.FillFormat.FillType = FillType.Solid;
cell.BorderBottom.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderBottom.Width = 5;
cell.BorderLeft.FillFormat.FillType = FillType.Solid;
cell.BorderLeft.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderLeft.Width = 5;
cell.BorderRight.FillFormat.FillType = FillType.Solid;
cell.BorderRight.FillFormat.SolidFillColor.Color = Color.Red;
cell.BorderRight.Width = 5;
}
//Add text to the merged cell
tbl[0, 0].TextFrame.Text = “Merged Cells”;
tbl[0, 0].FillFormat.FillType = FillType.Solid;
tbl[0, 0].FillFormat.SolidFillColor.Color = Color.Red;
ITextFrame txtFrame = tbl[0, 0].TextFrame;
txtFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
txtFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.White;
//Write PPTX to Disk
pres.Save(path + “table.pptx”, SaveFormat.Pptx);
}
}
I hope this will be helpful.
Many Thanks,