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 15, 2020 3:22 pm

Hi Rachel,
Hope you are doing well.

It seems there is an issue with the table while coloring the cell text of it in power-point using spire.presentation.it is not giving any error but also not doing the color of text.

Please see attached input(OrgChartsClassic_Template.pptx) and output(Output not coloring the text in a table cell.pptx) file for your reference which i have used for code.

As you can see in my input and output file, I am coloring the text of cell in second row and first column in a table- as Medium Blue RBG 0, 131, 169 but it is not doing. same thing like this doing for second row and column in same table as Medium Gray R150, G150, B150 but it did nothing here as well.

Same like the above i am doing for the second row and third & fourth column coloring of text of cell in a table.nothing colored in text.

i have used the below code and no error comes but it also won't do the required color to text.

Dim ppt As Presentation = New Presentation()

ppt.LoadFromFile("C:\Users\A0741818\Documents\Visual Studio 2015\WebSites\Hyperlink Error on node in SmartArt in PPT\OrgChartsClassic_Template.pptx")
Dim tbl As ITable

For Each shapenew As IShape In ppt.Slides(0).Shapes
If TypeOf shapenew Is ITable Then
tbl = shapenew
Exit For
End If
Next

tbl(0, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
tbl(0, 1).TextFrame.Paragraphs(0).Text = "Position Ttitle"
tbl(0, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
tbl(0, 1).TextFrame.TextRange.FontHeight = 10
tbl(0, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(0, 131, 169)

tbl(1, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
tbl(1, 1).TextFrame.Paragraphs(0).Text = "Position ID"
tbl(1, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
tbl(1, 1).TextFrame.TextRange.FontHeight = 10
tbl(1, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(150, 150, 150)

tbl(2, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
tbl(2, 1).TextFrame.Paragraphs(0).Text = "Incumbent Name"
tbl(2, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
tbl(2, 1).TextFrame.TextRange.FontHeight = 10
tbl(2, 1).FillFormat.SolidColor.Color = Color.FromArgb(248, 248, 248)
tbl(2, 1).TextFrame.TextRange.Format.IsBold = Spire.Presentation.TriState.True
tbl(2, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(0, 131, 169)

tbl(3, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
tbl(3, 1).TextFrame.Paragraphs(0).Text = "Incumbent ID"
tbl(3, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
tbl(3, 1).TextFrame.TextRange.FontHeight = 10
tbl(3, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(150, 150, 150)

ppt.SaveToFile("C:\Users\A0741818\Documents\Visual Studio 2015\WebSites\Hyperlink Error on node in SmartArt in PPT\Output not coloring the text in a table cell.pptx", FileFormat.Pptx2013)


Please provide the solution for this asap as i have a urgent project deliverable.

Looking for a positive response. Thanks in advance.


Thanks & Regards,
Anil Kumar

anilbits001
 
Posts: 41
Joined: Thu Sep 05, 2019 12:50 pm

Wed Sep 16, 2020 8:18 am

Hello,

Thanks for your inquiry.
In addition to setting the fill color, you also need to set the fill type. Below is the modified code for your reference. If there are any questions, please feel free to write back.
Code: Select all
Dim ppt As Presentation = New Presentation()

        ppt.LoadFromFile("OrgChartsClassic_Template.pptx")
        Dim tbl As ITable

        For Each shapenew As IShape In ppt.Slides(0).Shapes
            If TypeOf shapenew Is ITable Then
                tbl = shapenew
                Exit For
            End If
        Next

        tbl(0, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
        tbl(0, 1).TextFrame.Paragraphs(0).Text = "Position Ttitle"
        tbl(0, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
        tbl(0, 1).TextFrame.TextRange.FontHeight = 10
        tbl(0, 1).TextFrame.TextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
        tbl(0, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(0, 131, 169)

        tbl(1, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
        tbl(1, 1).TextFrame.Paragraphs(0).Text = "Position ID"
        tbl(1, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
        tbl(1, 1).TextFrame.TextRange.FontHeight = 10
        tbl(1, 1).TextFrame.TextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
        tbl(1, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(150, 150, 150)

        tbl(2, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
        tbl(2, 1).TextFrame.Paragraphs(0).Text = "Incumbent Name"
        tbl(2, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
        tbl(2, 1).TextFrame.TextRange.FontHeight = 10
        tbl(2, 1).FillFormat.SolidColor.Color = Color.FromArgb(248, 248, 248)
        tbl(2, 1).TextFrame.TextRange.Format.IsBold = Spire.Presentation.TriState.True
        tbl(2, 1).TextFrame.TextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
        tbl(2, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(0, 131, 169)

        tbl(3, 1).TextFrame.Paragraphs(0).TextRanges.Clear()
        tbl(3, 1).TextFrame.Paragraphs(0).Text = "Incumbent ID"
        tbl(3, 1).TextFrame.TextRange.LatinFont = New TextFont("Arial")
        tbl(3, 1).TextFrame.TextRange.FontHeight = 10
        tbl(3, 1).TextFrame.TextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
        tbl(3, 1).TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(150, 150, 150)

        ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013)


Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Tue Sep 29, 2020 4:00 am

Hello,

Greetings from E-iceblue.
How is your issue now? Could you please give us some feedback at your convenience?

Sincerely
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.Presentation