我在项目中使用ASPOSE幻灯片执行PPT任务。我想更改表格标题的background-color,但是在Aspose论坛中找不到任何解决方案。有人可以为我提供解决方案吗?
ISlide sld = press.Slides[0];
double[] dblCols = { 250, 250};
double[] dblRows = { 70, 70, 70,70 };
// Add table shape to slide
ITable tbl = sld.Shapes.AddTable(100, 100, dblCols, dblRows);
tbl[0, 1].TextFrame.Text = "some text";
tbl[0, 2].TextFrame.Text = "some text";
tbl[0, 3].TextFrame.Text = "some text";
tbl[0, 3].BorderBottom.FillFormat.FillType = FillType.Solid;
tbl[0, 3].FillFormat.SolidFillColor.BackgroundColor = Color.Blue;
tbl[0,3].BorderBottom.Width = 2;
Portion portion = (Portion)tbl[0, 1].TextFrame.Paragraphs[0].Portions[0];
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
}
答案 0 :(得分:0)
@pankaj,
我观察到您与设置表标题背景有关的要求。请尝试使用以下示例代码,该示例代码具有为标题行单元格之一设置填充颜色的示例。您也可以将其复制到其他单元格。
public static void TestTableBackground()
{
Presentation press = new Presentation();
ISlide sld = press.Slides[0];
double[] dblCols = { 250, 250 };
double[] dblRows = { 70, 70, 70, 70 };
// Add table shape to slide
ITable tbl = sld.Shapes.AddTable(100, 100, dblCols, dblRows);
tbl[0, 1].TextFrame.Text = "some text";
tbl[0, 2].TextFrame.Text = "some text";
tbl[0, 3].TextFrame.Text = "some text";
tbl[0, 0].FillFormat.FillType = FillType.Solid;
tbl[0, 0].FillFormat.SolidFillColor.Color = Color.Blue;
Portion portion = (Portion)tbl[0, 1].TextFrame.Paragraphs[0].Portions[0];
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
press.Save(@"C:\Aspose Data\TableFormat.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
我正在Aspose中担任支持开发人员/宣传人员。