Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add to_pdf() support for Chart and Range #1708

Closed
fzumstein opened this issue Aug 25, 2021 · 6 comments · Fixed by #1808
Closed

add to_pdf() support for Chart and Range #1708

fzumstein opened this issue Aug 25, 2021 · 6 comments · Fixed by #1808
Milestone

Comments

@fzumstein
Copy link
Member

No description provided.

@fzumstein fzumstein modified the milestones: 0.24.9, 0.24.10 Aug 25, 2021
@FabianGoessling
Copy link
Contributor

Just stumbled across this issue and started coding a first iteration:

https://github.com/FabianGoessling/xlwings

If this is going in the right direction, i'd love to contribute, but so far this is blindly coded on a Mac without Excel installation.

@fzumstein
Copy link
Member Author

This would only make sense if it can be exported directly from Excel, without png in the middle (from what I can see, you're doing this). Something like this (it would export the whole sheet though which it shouln't, so not sure it'll work out:

import xlwings as xw
from xlwings.constants import FixedFormatType, FixedFormatQuality

book = xw.books.active
book.sheets.active.charts[0].api[1].ExportAsFixedFormat(Type=FixedFormatType.xlTypePDF,
                                                        Filename=r'C:\Users\felix\Desktop\test.pdf',
                                                        Quality=FixedFormatQuality.xlQualityStandard,
                                                        IncludeDocProperties=True,
                                                        IgnorePrintAreas=False,
                                                        OpenAfterPublish=False)

@FabianGoessling
Copy link
Contributor

FabianGoessling commented Sep 3, 2021

I agree, i totally missed the ExportAsFixedFormat method in the VBA Reference.

If you add

'''
book.sheets.active.charts[0].api[0].Select()
'''

before the export, your code does the job.
For ranges it is the same, except the non-tuple api..

@fzumstein
Copy link
Member Author

gotcha, thanks for letting me know!

@FabianGoessling
Copy link
Contributor

If you didn't implement it already, I'll do it or at least make a first draft, so give me a sign.

@fzumstein
Copy link
Member Author

Feel free to go for it!

@fzumstein fzumstein modified the milestones: 0.25.0, 0.25.1 Oct 26, 2021
@fzumstein fzumstein modified the milestones: 0.25.1, 0.25.2 Nov 11, 2021
@fzumstein fzumstein modified the milestones: 0.25.2, 0.25.3, 0.25.4 Dec 3, 2021
@fzumstein fzumstein removed this from the 0.26.1 milestone Feb 1, 2022
@fzumstein fzumstein added this to the 0.26.2 milestone Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants