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.

Sun Oct 25, 2020 5:57 pm

Hi

I'm using the freespire.presentation edition of the solution, I have a existing Powerpoint slide which I am trying to replace text values but the islide.replacealltext sub doesn't work on tables.

My slide has textbox with the value 'TEMP-Name' and Temp-Name also exists within a table. But executing the sub means only the textbox is updated. How do I update the table with the same time ?

my code stub: (built to show the issue)

Dim presentation As New Presentation()

presentation.LoadFromFile("Template-G0.pptx")
presentation.SaveToFile("hello.pptx", FileFormat.Pptx2013)

Dim tmpslide As ISlide

tmpslide = presentation.Slides(0)
tmpslide.ReplaceAllText("Temp-Gate", "GO", False)
tmpslide.ReplaceAllText("Temp-ID", "ID : " & "425", False)
tmpslide.ReplaceAllText("Temp-Desc", "Description: The long test messagewithin the file to see if this helps to be domes thing link this work... thes cosde m thes cost might just work", False)
tmpslide.ReplaceAllText("Temp-Name", "Hello World Project", False)
tmpslide.ReplaceAllText("Temp-Desc", "Test", False)

'save the document
presentation.SlideSize.Type = SlideSizeType.Screen16x9
presentation.SaveToFile("hello.pptx", FileFormat.Pptx2013)

Thanks

systemshark
 
Posts: 4
Joined: Sun Oct 25, 2020 12:55 pm

Mon Oct 26, 2020 3:01 am

Hello,

Thanks for your inquiry.
To help us investigate further, please provide your source PPT file. You can upload it here or send it to us (support@e-iceblue.com) via email. Thanks in advance.
Besides, you can also test your case with our latest commercial version Spire.Presentation Pack Hotfix Version:5.9.5, as it is more stable and contains more bug fixes.

Sincerely,
Elena
E-iceblue support team
User avatar

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

Mon Oct 26, 2020 1:53 pm

Hiya,

please find attached the sample POwerpoint file.

I've now tried 5.9.5 and it worked, but the cost of the upgrade is huge here in poland. So it here a workaround ? Like do you have a code stub for accessing the table ?

Regards
Systemshark

systemshark
 
Posts: 4
Joined: Sun Oct 25, 2020 12:55 pm

Tue Oct 27, 2020 5:51 am

Hello,

Thank you for providing file.
I did an initial test and found that it is indeed the same as you mentioned, this issue exists in the free version but not in the commercial version. For your situation, here is a workaround for you, as shown in the following code. If you have further questions, please feel free to contact us.
Code: Select all
Public Sub replaceTextInTable(ByVal slide As ISlide, ByVal oldString As String, ByVal newString As String)
        Dim table As ITable = Nothing
        For Each shape As IShape In slide.Shapes
            If (TypeOf shape Is ITable) Then
                table = CType(shape, ITable)
                'Traverse through the cells of table.
                For Each row As TableRow In table.TableRows
                    For Each cell As Cell In row
                        Dim text As String = cell.TextFrame.Text
                        If text.Contains(oldString) Then
                            cell.TextFrame.Text = text.Replace(oldString, newString)
                        End If
                    Next
                Next
            End If
        Next
    End Sub


Sincerely,
Elena
E-iceblue support team
User avatar

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

Tue Oct 27, 2020 8:55 am

thank you.

systemshark
 
Posts: 4
Joined: Sun Oct 25, 2020 12:55 pm

Tue Oct 27, 2020 9:53 am

Hello,

You are welcome. If you encounter any issues related our product in the future, just feel free to contact us.
Have a nice day!

Sincerely,
Elena
E-iceblue support team
User avatar

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

Tue Oct 27, 2020 11:01 am

Sorry follow on question,

How do I set the background color of the Cell with the text which has change?

I've tried
cell.fillformat.SoildColor=Color.Blue

but it's a read only property, who do I get to the background color?

Thanks
systemshark

systemshark
 
Posts: 4
Joined: Sun Oct 25, 2020 12:55 pm

Wed Oct 28, 2020 2:53 am

Hello,

Thanks for your inquiry.
Please refer to the following code snippet to set the background color of the cell. If you have further questions, just feel free to write back.
Code: Select all
cell.FillFormat.FillType = Drawing.FillFormatType.Solid
cell.FillFormat.SolidColor.Color = Color.Red


Sincerely,
Elena
E-iceblue support team
User avatar

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

Wed Nov 11, 2020 1:30 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