繁体   English   中英

表头列背景颜色不变

[英]Table header column background color not changing

我在我的项目中使用 ASPOSE Slides 来执行 PPT 任务。 我想更改表格标题背景颜色,但在 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;

}

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM