Table header 列背景颜色不变

Table header column background color not changing

我在我的项目中使用ASPOSE Slides来执行PPT任务。我想改变我的 table header 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;

}

我已经观察到您对设置 table header 背景的要求。请尝试使用以下示例代码,其中包含为 header 行单元格之一设置填充颜色的示例。您也可以对其他单元格进行相同的复制。

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 担任支持开发人员/传播者。