locked
Help: Convert excel chart sheet to pdf RRS feed

  • Question

  • Hi everyone,

    I have problem with converting file excel to pdf. For the chart sheet, the file pdf generated is not good, the chart in the sheet is not full page, it's very small at the corner of page => it's very bad

    I used Microsoft.Office.Interop.Excel:

    I tested with this file: http://www.mediafire.com/file/z9gr956mdarg429/sales.xlsx

    Here's my code:

    excelApp = new Microsoft.Office.Interop.Excel.Application();

     book = excelApp.Workbooks.Open(input, unknown, unknown, unknown, unknown, unknown,
                                                   unknown, unknown, unknown, unknown, unknown, unknown,
                                                   unknown, unknown, unknown);

     if (book != null)

     {

                     book.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF,
                                                 output, Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityStandard,
                                                 true, true, 1, 32767, unknown, unknown);

    }

    I dont know how to do with the chart sheet. I need the chart is full on the page

    Anyone can help me solve this pb ?

    Thank you very much


    • Edited by allerbibi Tuesday, July 24, 2012 9:17 AM
    • Moved by Mike Feng Wednesday, July 25, 2012 9:26 AM Excel (From:.NET Base Class Library)
    Tuesday, July 24, 2012 9:16 AM

Answers

  • Hi,

    Thanks for posting in the MSDN Forum.

    I have download the excel file and  reproduced your issue. I don't think your code has the problem. I found there is a little error existing in the layout of the Attainment analysis summary chart. I'd recommend you try to open the excel, select the Attainment analysis summary, and save it again. Then, you can convert the new saved excel file to pdf and you will get a correct chart which is full of the page. Please try the method.

    Hope this can help you.

    Best Regards, 


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    • Proposed as answer by Leo_Gao Thursday, July 26, 2012 7:57 AM
    • Marked as answer by Leo_Gao Tuesday, July 31, 2012 7:59 AM
    Thursday, July 26, 2012 7:56 AM

All replies

  • Just a guess without looking into excel automation.  If 32767 is a row or column index, that could be why it's so small.

    This signature unintentionally left blank.

    Tuesday, July 24, 2012 10:14 AM
  • Hi,

    Thanks for posting in the MSDN Forum.

    I have download the excel file and  reproduced your issue. I don't think your code has the problem. I found there is a little error existing in the layout of the Attainment analysis summary chart. I'd recommend you try to open the excel, select the Attainment analysis summary, and save it again. Then, you can convert the new saved excel file to pdf and you will get a correct chart which is full of the page. Please try the method.

    Hope this can help you.

    Best Regards, 


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    • Proposed as answer by Leo_Gao Thursday, July 26, 2012 7:57 AM
    • Marked as answer by Leo_Gao Tuesday, July 31, 2012 7:59 AM
    Thursday, July 26, 2012 7:56 AM