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.

Wed Apr 29, 2020 10:55 am

Hi Team,

Hope you are doing well.

We have a requirement for spire.presentation that need to remove underline from hyperlink in a slide of PPT file. unfortunately,i didn't find any code for this using spire.presentation.However, when i do research on this then found that this feature is available using spire.Doc in word doc..

Please refer below links for spire.doc which is currently doing this.

https://www.e-iceblue.com/Knowledgebase ... ith-C.html


So could you please provide this functionality using spire.presenation as well as we need this in our project ASAP?

Note:- We have already purchased licence of spire.presentation .

Looking for a positive response. Thanks in advance.

Thanks & Regards,
Anil Kumar

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

Thu Apr 30, 2020 2:52 am

Hello,

Thanks for your inquiry.
Our Spire.Presentation is based on Microsoft PowerPoint, and I have verified that using Microsoft PowerPoint can't set the hyperlink text without underline. Sorry we don't support it either. Hope you can understand.
However, I searched some technical forums and learned that you can directly add the hyperlink to the text box instead of text, so that the hyperlink is not underlined. Below is the corresponding code for your reference. If there is any question, please get back to us.
Code: Select all
    Presentation presentation = new Presentation();
    IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 150, 50));
    shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
    shape.Fill.FillType = FillFormatType.Solid;
    shape.Fill.SolidColor.Color = Color.LightGreen;
    shape.ShapeStyle.LineColor.Color = Color.White;
    shape.TextFrame.Text = "E-iceblue";
    ClickHyperlink hyperlink = new ClickHyperlink("http://www.e-iceblue.com");
    //Add hyper link to text box
    shape.Click = hyperlink;         
    presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2013);


Output:
My_output.png

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed May 06, 2020 6:07 am

Hi Rachel,

Thanks for your reply.

We have multiple text in a single shape and we need to set separate hyperlink on each text in a shape.So this hyperlink adding on a shape won't work for us as it will set same text for whole text in that shape.

I agreed that using Microsoft PowerPoint can't set the hyperlink text without underline however, we have different PPT file having different slide size from each other PPT file and when we see the PPT in normal mode then it's looks perfect but when we see PPT in Slide show mode then the underline of hyperlink looks weird as it comes before text thus we thought we can remove underline from it then our issue get resolved but now we are still facing this issue and no solution seems from your side as well.


Thanks & Regards,
Anil Kumar

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

Wed May 06, 2020 7:59 am

Hello,

Thanks for your response.
After further investigation, I found an alternative solution. You can set the underline color to be the same as the background color of the text box, so that it looks like there is no underline. However, I found that using the code below to set the color of the underline will not take effect. I have posted this issue to our Dev team with the ticket SPIREPPT-1166 for further investigation and fixing. If there is any update, we will let you know immediately.
Code: Select all
    shape.TextFrame.TextRange.TextUnderlineType = TextUnderlineType.Single;
    shape.TextFrame.TextRange.UnderlineFillFormat.FillType = FillFormatType.Solid;
    //If the background color of the text box is white
    shape.TextFrame.TextRange.UnderlineFillFormat.SolidColor.Color = Color.White;


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon May 11, 2020 2:25 pm

Hi Rachel,

Hope you are doing well.

Just following up, is there any update on this? as we need this for our deliverable.

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

Tue May 12, 2020 3:09 am

Hi Anil,

Thanks for your following up.
Sorry to tell you that our Dev team is still fixing this issue. I have urged them to speed up the fixing. Please spare us more time. Anyway, we will let you know as soon as it is fixed. Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri May 15, 2020 1:55 pm

Hi Rachel,

Hope you are doing well.

Just following up here, is there any update on this? as we need this for our deliverable.

Thanks in advances.Looking for a positive response.

Thanks & Regards,
Anil Kumar

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

Mon May 18, 2020 7:01 am

Hi Anil,

Thanks for your following up and sorry for the late reply as weekend.
Glad to tell you that the issue SPIREPPT-1166 has been fixed. Considering your situation, we compiled a temporary version for you. Please download it from the following link.
http://www.e-iceblue.com/downloads/Temp ... _5.5.1.zip

Code for your reference:
Code: Select all
    Presentation presentation = new Presentation();
    IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 150, 50));
    shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
    shape.Fill.FillType = FillFormatType.Solid;
    shape.Fill.SolidColor.Color = Color.White;
    shape.ShapeStyle.LineColor.Color = Color.Black;

    TextParagraph para1 = new TextParagraph();
    TextRange tr1 = new TextRange("E-iceblue");
    tr1.ClickAction.Address = "http://www.e-iceblue.com";
    para1.TextRanges.Append(tr1);
    shape.TextFrame.Paragraphs.Append(para1);
    shape.TextFrame.Paragraphs.Append(new TextParagraph());

    /************Set underline color****************/
    for(int i = 0; i < shape.TextFrame.Paragraphs.Count; i++)
    {
        foreach (TextRange textRange in shape.TextFrame.Paragraphs[i].TextRanges)
        {
            textRange.TextUnderlineType = TextUnderlineType.Single;
            textRange.UnderlineFillFormat.FillType = FillFormatType.Solid;
            textRange.UnderlineFillFormat.SolidColor.Color = Color.White;
            textRange.IsInheritUnderlineFill = TriState.True;//!!!IMPORTANT
        }
    }
    /************Set underline color****************/

    presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2013);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue May 19, 2020 10:22 am

Hi Rachel,

Hope you are doing well.

Thanks for your an quick update.We really like it.

We tried the provided code and it seems the underline form hyperlink is not visible. that's exactly we want.however, when we have underscore(_) in any text string then it's not giving correct output. Please see details below:
We have a text string "_All_CEOs" so when we see the PPT output in normal mode then it's showing correctly but in slide show mode it replaced underscore with space automatically. this is not correct.

I have attached a PPT file from our output. [b]please see slide one in normal and slide show mode for the issue..Please see text as highlighted in blue at top right coroner in slide one. [/b]

Therefore, whenever we have any text string which contain underscore may be one or more than one.it should show exact same string in both normal and slide show mode. it should only remove/color white the underline from hyperlink but underscore should be always there within the text..

Thanks in advance. Looking for a positive response.

Thanks & Regards,
Anil Kumar

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

Wed May 20, 2020 6:16 am

Hi Anil,

Thanks for your feedback.
I did notice the issue you mentioned. And I tried to do the same in Microsoft PowerPoint, but found that in slide show mode, the character "_" was also replaced with the space. You can verify it on your side.
However, you could refer to the following code to avoid this issue. If there is any question, please feel free to write back.
Code: Select all
        Presentation presentation = new Presentation();
        IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 150, 50));
        shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
        shape.Fill.FillType = FillFormatType.Solid;
        shape.Fill.SolidColor.Color = Color.White;
        shape.ShapeStyle.LineColor.Color = Color.Black;

        TextParagraph para1 = new TextParagraph();
        Regex regx = new Regex("(_)");
        string hyperlinkText = "_All_CEOs";
        string[] split = regx.Split(hyperlinkText);
        foreach (string str in split)
        {
            TextRange tr = new TextRange(str);
            para1.TextRanges.Append(tr);
            if (!str.Equals("_"))
            {
                tr.TextUnderlineType = TextUnderlineType.Single;
                tr.UnderlineFillFormat.FillType = FillFormatType.Solid;
                tr.UnderlineFillFormat.SolidColor.Color = Color.White;
                tr.IsInheritUnderlineFill = TriState.True;
            }
            tr.ClickAction.Address = "http://www.e-iceblue.com";
        }

        shape.TextFrame.Paragraphs.Append(para1);
        shape.TextFrame.Paragraphs.Append(new TextParagraph());
        presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2013);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed May 20, 2020 11:19 am

Hi Rachel,

Thanks for quick response.

I verified that the character "_" was not replaced with the space in our slide in slide show mode. the file which i shared with you was generated using code provided by you that's why in slide show mode, the character "_" was also replaced with the space in my earlier attached PPT file.

We have used the new code as provided by you and it seems that the issue still exists. Now it is showing the underscore in both mode but it seems that the issue reached as the same starting point from where we started this .Please see details below:

The issue is that whenever we have the character "_" in a text string. we have different PPT file having different slide size from each other PPT file and when we see the PPT in normal mode then it's looks perfect but when we see PPT in Slide show mode then the character "_" of hyperlink text looks weird as it comes before the charcter thus we thought we can remove underline from it then our issue get resolved.

Please see attached issue file which was generated after using your latest code.Please see text as highlighted in blue at top right coroner in slide one. [/b]
1. we have a text string "_All_CEOs > President &_CEO > EVP, Human Resources" in this attached file in slide one. the character "_" looking fine on normal mode but when we do slide show mode then the first underscore "_" break into two "_" character and the second underscore that is between "All" and "CEOs" moved below character "C" from text string "_All_CEOs".
2. Same thing happened in text string "President &_CEO". the only underscore having between "&" and "CEO" and it moved below the character "C".


So in both the cases the in normal mode they looks fine but in slide show mode the character "_" moved. it should not be as it's looked very wearied. it should show exactly same like normal mode in slide show mode as well.


Thanks in advance. Looking for a positive response.

Thanks & Regards,
Anil Kumar

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

Thu May 21, 2020 6:07 am

Hi Anil,

Thanks for your response.
I re-checked it in Microsoft PowerPoint and indeed found that the character "_" was not replaced with the space, but the color was so light that it looked like a space. If I increase the font size to a certain degree or apply a bold style to it, I can see the character "_" in slide show mode, as shown below.
Created_by_MS_PowerPoint&in_slide_show_mode.png

As for the new code I provided, it could work great on my side. Also, I opened the PPT file you provided in several different versions of Microsoft PowerPoint, but did not encounter the problem you described. Which version of Microsoft PowerPoint are you using?
Different_versions_in_slide_show_mode.png

Besides, I tried to apply bold style to the character "_", like the below code, and it also works well on my side. Attached is my output file for your reference. Please try this code and then tell us your testing result. Looking forward to your further feedback.
Code: Select all
    Presentation presentation = new Presentation();
    IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 300, 50));
    shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
    shape.Fill.FillType = FillFormatType.Solid;
    shape.Fill.SolidColor.Color = Color.White;
    TextParagraph para1 = new TextParagraph();
    Regex regx = new Regex("(_)");
    string hyperlinkText = "_All_CEOs > President &_CEO > EVP, Human Resources";
    string[] split = regx.Split(hyperlinkText);
    foreach (string str in split)
    {
        TextRange tr = new TextRange(str);
        para1.TextRanges.Append(tr);
        tr.Format.FontHeight = 12;
        tr.TextUnderlineType = TextUnderlineType.Single;
        tr.UnderlineFillFormat.FillType = FillFormatType.Solid;
        tr.UnderlineFillFormat.SolidColor.Color = Color.White;
        tr.IsInheritUnderlineFill = TriState.True;
        if (str.Equals("_"))
        {
            tr.Format.IsBold = TriState.True;
        }
        tr.ClickAction.Address = "http://www.e-iceblue.com";
    }
    shape.TextFrame.Paragraphs.Append(para1);
    shape.TextFrame.Paragraphs.Append(new TextParagraph());
    presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2013);

hyperlink.zip

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri May 22, 2020 4:46 am

Hi Rachel,

Thanks for your response.

We are using Microsoft PowerPoint 365 version. We can't increase font size of the text as we have a requirement to set font-size only to Arial 10.We are applying bold style to it as well.The issue still exists.

Note:- The file i shared with you have different slide size,text alignment and shape placement compare to yours file.so Please see the details below from my file:
1. the text alignment should be right alignment
2. The placement of shape which contain text is placed top right corner in slide.
3. The slide size and format should be exactly the same.
4. No text effects or animation effects should be there

So please do the above steps into your file and then try to generate the output. If possible, then please try to create exact shape,slide size,text from my slide to yours and then create output.


Thanks & Regards,
Anil Kumar

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

Fri May 22, 2020 9:39 am

Hello,

Thanks for your inquiry.
I opened your PPT file in Microsoft PowerPoint 365 and indeed noticed that the character "_" was displayed incorrectly. Meanwhile, I set up the code according to your description and did reproduce your issue. Besides, after a series of tests, I found that this issue didn't occur when the text is left aligned.

In fact, different versions of Microsoft PowerPoint have different calculation rules, which may cause differences in the display results. And as I mentioned before, I opened your file in Microsoft PowerPoint 2010, Microsoft PowerPoint 2013 and Microsoft PowerPoint 2016 and didn't encounter any problems. Our Spire.Presentation is mainly based on Microsoft PowerPoint 2010, I'm afraid this issue is caused by different calculation rules of Microsoft PowerPoint 365 . Hope you can understand.

Anyway, I will pass this issue to our Dev team for further investigation to see if there is any possible solution. We will keep you informed if there is any update.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri May 29, 2020 5:59 am

Hi Rachel,

Thank you for your response.

your are right .this issue didn't occur when the text is left aligned.however, we have a requirement so need text as right aligned only.

We will only use Microsoft PowerPoint 365 for our deliverable and our client also using the same,thus, we need the solution using MS PowerPoint 365.

Hope, we will get a solution from your slide very soon.

Looking for a positive response. Thanks in advance.

Thanks & Regards,
Anil Kumar

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

Return to Spire.Presentation