Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Value does not fall within the expected range." error while exporting excel to pdf
    primarykey
    data
    text
    <p>I am getting the above error while trying to export the excel 2007(xlsx) format workbook to pdf. The workbook contains only one sheet and I have Ms Office 2007 installed on my windows 7 PC. Here is the stacktrace</p> <pre><code> at Microsoft.Office.Interop.Excel.WorkbookClass.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr) at schoolwisereportprint.converttopdf() in C:\Users\username\Desktop\Dpp2012New\schoolwisereportprint.aspx.vb:line 33 at schoolwisereportprint.Button1_Click(Object sender, EventArgs e) in C:\Users\username\Desktop\Dpp2012New\schoolwisereportprint.aspx.vb:line 158 </code></pre> <p>Here is my converttopdf() function:</p> <pre><code>Public Sub converttopdf() Dim fileName As String = Server.MapPath("rahulserver/pdfreprt.xlsx") Dim xlsApp = New Microsoft.Office.Interop.Excel.Application xlsApp.ScreenUpdating = False Dim xlsBook As Microsoft.Office.Interop.Excel.Workbook Dim paramExportFormat As XlFixedFormatType = XlFixedFormatType.xlTypePDF Dim paramExportQuality As XlFixedFormatQuality = XlFixedFormatQuality.xlQualityStandard Dim paramOpenAfterPublish As Boolean = False Dim paramIncludeDocProps As Boolean = True Dim paramIgnorePrintAreas As Boolean = True Dim paramFromPage As Object = Type.Missing Dim paramToPage As Object = Type.Missing xlsBook = xlsApp.Workbooks.Open(fileName, UpdateLinks:=False, ReadOnly:=False) xlsBook.ExportAsFixedFormat(paramExportFormat, "rahulserver/pdfreprt" &amp; ".pdf", paramExportQuality, paramIncludeDocProps, paramIgnorePrintAreas,paramFromPage, paramToPage, paramOpenAfterPublish) xlsBook.Close(SaveChanges:=False) xlsApp.Quit() MsgBox("successfully converted to pdf!") End Sub </code></pre> <p>Even changing paramFromPage and paramToPage to 1 and 1 respectively does not help. I have already spent a whole day troubleshooting this error but could not find a way. Now I look upon SO to get me out of this...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload