Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

hyperlink and tooltip property is not working? #758

Closed
kuldeept70 opened this issue May 31, 2020 · 7 comments
Closed

hyperlink and tooltip property is not working? #758

kuldeept70 opened this issue May 31, 2020 · 7 comments
Assignees
Milestone

Comments

@kuldeept70
Copy link

kuldeept70 commented May 31, 2020

I used this parameter { text: file.viewName + " ", options: { color: '3361FF', fontSize: 18, paraSpaceAfter: 18, hyperlink: { rId: 1, url: file.webUrl, tooltip: 'Visit File' } } } in slide.addText() ,but tooltip and hyperlink is not working.

@CraigH2013
Copy link

CraigH2013 commented Jun 1, 2020

Having a similar issue when trying to add multiple links inside table cells. I can add one link and it works fine like this:

row.push({
    text: "Link without Tooltip",
    options: {
        hyperlink: {
            url: "https://www.google.com",
        },
    },
});

But if I try to add multiple links in a cell like so:

row.push({
    text: [
        {
            text: "Link without Tooltip",
            options: { hyperlink: { url: "https://github.com/gitbrent" } },
        },
        {
            text: "Link without Tooltip",
            options: { hyperlink: { url: "https://github.com/gitbrent" } },
        },
    ],
});

I get an error that says, PowerPoint found a problem with content in myFile.pptx. PowerPoint can attempt to repair the presentation.

I also noticed an error in the documentation that says the type of value to use for the hyperlink option is a string.

@gitbrent gitbrent self-assigned this Jun 2, 2020
@gitbrent gitbrent added this to the 3.3.0 milestone Jun 2, 2020
@gitbrent
Copy link
Owner

gitbrent commented Jun 3, 2020

Thanks @kuldeept70

The type defs were incorrect.

Updated result:
Screen Shot 2020-06-02 at 23 29 32

Usage:

slide.addText("Hyperlinks:", { x:0.5, y:6.0, w:'90%', h:0.3, margin:0.123, color:'0088CC' });
slide.addText(
    [{ text: 'Link with Tooltip', options: { hyperlink: { url: 'https://github.com/gitbrent/pptxgenjs', tooltip: 'Visit Homepage' } } }],
    { x:0.5, y:6.4, w:3, h:0.6, margin:10, fill:'F1F1F1', fontSize:14, align:'center' }
);
slide.addText(
    [{ text: 'Link without Tooltip', options: { hyperlink: { url: 'https://github.com/gitbrent' } } }],
    { x:5.0, y:6.4, w:3, h:0.6, margin:10, fill:'F1F1F1', fontSize:14, align:'center' }
);
slide.addText(
    [{ text: 'Link to Slide #4', options: { hyperlink: { slide: '4' } } }],
    { x:9.5, y:6.4, w:3, h:0.6, margin:10, fill:'F1F1F1', fontSize:14, align:'center' }
);

Screen Shot 2020-06-02 at 23 32 28

@gitbrent
Copy link
Owner

gitbrent commented Jun 3, 2020

@CraigH2013 - the demo includes 2 hyperlinks on the same slide as your example shows and has no issues. The corruption may be caused by other objects.

@kuldeept70
Copy link
Author

kuldeept70 commented Jun 3, 2020

Hi @gitbrent , How I can get these changes? will these changes appear in next release or I can just upgrade my package to see the changes?

@gitbrent
Copy link
Owner

gitbrent commented Jun 4, 2020

@kuldeept70 - grab the newest index.d.ts file from the types directory and replace whats in your node_modules pptxgenjs folder currently for an immediate fix.

@CraigH2013
Copy link

@CraigH2013 - the demo includes 2 hyperlinks on the same slide as your example shows and has no issues. The corruption may be caused by other objects.

Multiple on the same slide, yes. But I said in the same cell within a table.

@gitbrent
Copy link
Owner

gitbrent commented Jun 5, 2020

@CraigH2013 - Ah, got it. Please open a new issue and i'll look into it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants