C# Excel Interop convert excel file to pdf file is not properly converting

This is actually the code I am making use of to import a format file, modify data on the excel, conserve it and at that point ship it as a pdf.

Given that I created this code as soon as just before yet in VB, I don’t observe why the succeed model will matter. In the past it worked penalty. Each versions work on Microsoft window 10 and also Excel 2013.

I am making an application that can easily handle input succeed reports as well as conserve them as a new documents, after that they need to have to be changed to a pdf. The problem I am actually running into is actually that the pdf is certainly not properly changed.

I can effectively take a succeed data as well as ship it as a PDF data in c#

Page distance and also height are actually homes of a color printer. You do not handle with that when you generate the pdf, the customer picks it when publishing the pdf.

What specification or even object do I require to get access to if you want to conserve the excel data as page width rather of page elevation?

Establish Microsoft XPS Document Article writer as nonpayment laser printer in web server. Due to the fact that ExportAsFixedFormat functionality executes Microsoft XPS Document Author to convert Excel to PDF.

In my task, I require to convert Excel to pdf. Can any one support me on this how to convert Excel to pdf?

Profile.PageSetup.ResolutionX = 600;
        Profile.PageSetup.ResolutionY = 600;       
        Profile.OutputLocation.Mode = LocationModeID.LM_PREDEFINED;
        Profile.OutputLocation.OverwriteExistingFile = false;

        Profile.PostProcessing.Mode = PostProcessingModeID.PP_OPEN_FOLDER;

        //Create a Excel's Application object
        Excel.Application ExcelApp = new Excel.ApplicationClass();

        Object ReadOnly = true;
        Object Missing = Type.Missing; //This will be passed when ever we don’t want to pass value
        //Open the document from a file
        Excel.Workbook Workbook = ExcelApp.Workbooks.Open(ExcelFilePath, Missing, ReadOnly, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing);

        //Change active worksheet settings and print it
        Excel.Worksheet Worksheet = (Excel.Worksheet)Workbook.ActiveSheet;
        Excel.PageSetup PageSetup = Worksheet.PageSetup;

        PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape;

        Object Preview = false;
        Worksheet.PrintOut(Missing, Missing, Missing, Preview, "Universal Document Converter", Missing, Missing, Missing);

Any individual feel free to assist me in Turning Excel to PDF in c# code. I have Microsoft Office 2003 is set up in server.I have the code which functions in Microsoft Office 2010. Given that XlFixedFormatType is actually not sustained in 2003, I am actually stopping working certainly there.

I have discovered the residential property required to force the export of your book in a PDF with Landscape viewpoint.

    excelWorkbook.ActiveSheet).PageSetup.Orientation =  

    Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + 
        "\\" + output);

Leave a Reply

Your email address will not be published. Required fields are marked *