Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3459648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:07:53+00:00 2026-05-18T10:07:53+00:00

I am having a problem programmatically exporting Excel sheets that contain sparklines to PDF

  • 0

I am having a problem programmatically exporting Excel sheets that contain sparklines to PDF format.

When I manually export the Excel sheet to PDF format using Excel 2010’s native PDF Exporting facility then everything works fine, but the moment I do it using simple COM automation then everything is exported to PDF with the exception of cells containing sparklines.

The weird thing is that when I add a few data bars to the excel sheet then the sparklines near the data bars are suddenly exported, but the ones further away from the data bars are not.

I have verified these problems on multiple different machines and operating systems. This may be related to the following question on StackOverflow.

I am using the following, very straight forward, VB.NET code. I have tried playing around with the various settings and variables, but no luck.

Public Class Form1

    Enum XlFixedFormatType
        xlTypePDF = 0
        xlTypeXPS = 1
    End Enum

    Enum XlUpdateLinks
        xlUpdateLinksUserSetting = 1
        xlUpdateLinksNever = 2
        xlUpdateLinksAlways = 3
    End Enum

    Enum XlFixedFormatQuality
        xlQualityStandard = 0
        xlQualityMinimum = 1
    End Enum

    Private Sub buttonConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonConvert.Click
        Dim pdf As String = Convert("C:\Sparkline.xlsx")
        Process.Start(pdf)
    End Sub

    Public Function Convert(ByVal fileName As String) As String
        Dim outPutFilename As String, printObject As Object = Nothing
        Dim app As Object      '** In reality this is a Microsoft.Office.Interop.Excel.Application
        Dim doc As Object      '** In reality this is a Microsoft.Office.Interop.Excel.Workbook

        app = CreateObject("Excel.Application")

        '** Open the _document
        doc = app.Workbooks.Open(fileName:=fileName, _
                                   UpdateLinks:=XlUpdateLinks.xlUpdateLinksNever, _
                                   ReadOnly:=True, _
                                   AddToMru:=False, _
                                   IgnoreReadOnlyRecommended:=True, _
                                   CorruptLoad:=True, _
                                   Editable:=False)

        '** Set visible sheets depending on selected range
        printObject = app.ActiveWorkbook.ActiveSheet

        '** Write the file under the same name, but with different extension
        outPutFilename = System.IO.Path.ChangeExtension(fileName, "pdf")

        printObject.ExportAsFixedFormat(Type:=XlFixedFormatType.xlTypePDF, _
                                fileName:=outPutFilename, _
                                quality:=XlFixedFormatQuality.xlQualityStandard, _
                                IncludeDocProperties:=False, _
                                IgnorePrintAreas:=False, _
                                OpenAfterPublish:=False)

        doc.Close(False)
        app.Quit()

        '** Return the name of the converted file
        Return outPutFilename

    End Function

End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:07:54+00:00Added an answer on May 18, 2026 at 10:07 am

    I have been in contact with Microsoft Support and they have acknowledged it is a bug. The product team is looking at it for inclusion in a future service pack.

    Until then, making the Application Visible before carrying out the export will solve the problem. If you don’t want the user to see it then you can position the window off screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem writing Norwegian characters into an XML file using C#. I
I am having problem with Monodevelop 2.4 on windows 7 x64. When using Control-Tab
We're having problem with a huge number of legacy stored procedures at work. Do
I'm having problem in the following line: rd.PrintOptions.PaperSize = PaperSize.PaperFanfoldStdGerman; it throws an exception
Having a problem getting a TreeView control to display node images. The code below
Having a problem trying to create a function, as part of a BizTalk helper
Im having a problem with a final part of my assignment. We get in
We were having a problem with our build server not checking out modifications from
I'm having a problem with an application hanging and giving me the default Please
I'm having a problem with my compiler telling me there is an 'undefined reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.