Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Sep 23, 2014 9:37 pm

Hi!

Is there way to fill a cell with a background color; similar to highlighting the text, right clicking and filling color via Powerpoint.

The best I got so far was to highlight the cell text, but it's not enough -- I need the whole cell to be colored.

Thanks in advance,
A

anonymoose
 
Posts: 3
Joined: Tue Sep 23, 2014 9:31 pm

Wed Sep 24, 2014 6:54 am

Hello,

Thanks for your inquiry.
The following codes are for your reference.
Code: Select all
        Presentation presentation = new Presentation();
        presentation.LoadFromFile("table.pptx");
        ITable table = null;
        foreach (IShape shape in presentation.Slides[0].Shapes)
        {
            if (shape is ITable)
            {
                table = (ITable)shape;
               
                foreach (TableRow row in table.TableRows)
                {
                    foreach (Cell cell in row)
                    {   
                        cell.FillFormat.FillType=FillFormatType.Solid;
                        cell.FillFormat.SolidColor.Color=Color.Gray;
                    }
                }
            }
        }
        presentation.SaveToFile( "result.pptx", FileFormat.Pptx2010);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Sep 24, 2014 4:21 pm

Thank you, Gary. It worked perfectly!

anonymoose
 
Posts: 3
Joined: Tue Sep 23, 2014 9:31 pm

Thu Sep 25, 2014 1:41 am

Hello,

Thanks for your response.
Glad to hear that. If you have any questions or need further help, feel free to contact us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Presentation