convert to excel

PDF-XChange Editor SDK for Developers

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
charuvasudev
User
Posts: 16
Joined: Wed Feb 11, 2009 5:48 am

convert to excel

Post by charuvasudev »

Hi,

Using ConvertPDF.pvp I have been able to convert pdf file to xlsx files. here is the code-(using vb.net)

If OpenFileDialog1.ShowDialog = DialogResult.OK Then
Dim Doc As PDFXEdit.IPXC_Document
Dim cov As PDFXEdit.IPXV_ExportConverter = Nothing
strfilepath = OpenFileDialog1.FileName
Doc = m_pxcInst.OpenDocumentFromFile(strfilepath, Nothing)
For i As Integer = 0 To Inst1.ExportConvertersCount - 1
If (Inst1.ExportConverter(i).ID = "conv.exp.office.xlsx") Then
cov = Inst1.ExportConverter(i)
Dim cab As PDFXEdit.ICab = Inst1.GetFormatConverterParams(False, cov.ID)
Dim strpath As String = strDownloadPath.ToString
Dim strguid As String = Guid.NewGuid().ToString
System.IO.Directory.CreateDirectory(strpath & "\" & strguid)
Dim fsInst As PDFXEdit.IAFS_Inst = CType(Inst1.GetExtension("AFS"), PDFXEdit.IAFS_Inst)
Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(strpath & "\" & strguid & "\" & System.IO.Path.GetFileNameWithoutExtension(strfilepath) & ".xlsx")
Dim openFileFlags As Int16 = CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_CreateAlways Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead Or AFS_OpenFileFlags.AFS_OpenFile_Write Or AFS_OpenFileFlags.AFS_OpenFile_FullCache)
Dim destFile As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(name, openFileFlags)
cov.Convert(Inst1, Doc, destFile, 0, cab, Nothing, 0, Nothing, Nothing)
End If
Next
Doc.Close()
End If

This code makes a new sheet for each page. I would like to create a single worksheet for the pdf file. I saw there is an option to set this in your end user editor. How can I achieve this in SDK. Pls see the attached screenshot for more clarity.

Rgds
Charu
Converttoxls.png
You do not have the required permissions to view the files attached to this post.
User avatar
MishaH
User
Posts: 29
Joined: Wed Sep 11, 2024 1:43 pm

Re: convert to excel

Post by MishaH »

Hi charuvasudev,

I’m not very experienced with VB, but the following snippet should point you in the right direction.
You can configure the sheet creation behavior via the converter parameters:

Code: Select all

Dim cab As PDFXEdit.ICab = Inst1.GetFormatConverterParams(False, cov.ID)
Dim options As PDFXEdit.ICabNode = cab.Root
options("NewSheetMode").v = 1 ' 0 - new sheet for each page, 1 - single sheet for the document (default is 0)
I hope this helps.
Please let me know if this works for you.

Kind regards,
Misha
charuvasudev
User
Posts: 16
Joined: Wed Feb 11, 2009 5:48 am

Re: convert to excel

Post by charuvasudev »

That's exactly what I needed..

Thank you
User avatar
Sean - PDF-XChange
Site Admin
Posts: 664
Joined: Wed Sep 14, 2016 5:42 pm

Re: convert to excel

Post by Sean - PDF-XChange »

:)
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623
charuvasudev
User
Posts: 16
Joined: Wed Feb 11, 2009 5:48 am

Re: convert to excel

Post by charuvasudev »

Hi,

I have created a module to convert pdf files to docx, xlsx and pptx files. My excel and docx files that are created as 'readonly'. I have passed license key. The docx and xlsx files are created as 'readonly' but pptx files are not. Do I need to set some other parameter?
Pls guide..

Rgds
charuvasudev
User
Posts: 16
Joined: Wed Feb 11, 2009 5:48 am

Re: convert to excel

Post by charuvasudev »

Hi,

Even though I have passed the license key, docx and xlsx files are created as 'readonly' but pptx files are not. How do I fix this?
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12449
Joined: Wed Jan 03, 2018 6:52 pm

Re: convert to excel

Post by Daniel - PDF-XChange »

Hello, charuvasudev

I have just passed this along for review, and will let you know when the Dev team gets back to us.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2474
Joined: Thu Jun 30, 2005 4:11 pm

Re: convert to excel

Post by Vasyl - PDF-XChange »

Try to add this:

Code: Select all

options("Salt").v = ""
options("Hash").v = ""
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Hello PDF-XChange SDK team,

In reference to this convert PDF implementation:
I am using the IPXV_ExportConverter::Convert method to convert PDFs to Word, Excel, and PowerPoint formats. The method signature I am working with is:

Code: Select all

IPXV_ExportConverter::Convert(
    IPXV_Inst*         pInst,
    IPXC_Document*     pSrc,
    IUnknown*          pDest,
    ULONG              nFlags,
    ICab*              pParams,
    IProgressMon*      pProgress,
    HANDLE_T           hWndParent,
    IPXV_PagesRegions* pSelPages,
    IUnknown*          pReserved
);

I specifically need guidance on how to correctly use the IProgressMon parameter (pProgress).

My goals are:

Display the default PDF-XChange progress bar during long conversions (e.g., large PDFs being converted to Word/Excel/PowerPoint).

Ensure the progress dialog includes a Cancel button that allows the user to abort the conversion process.

At present, I am unsure of:

How to properly instantiate or obtain an IProgressMon object.

Whether I should implement my own IProgressMon class or use a built-in one from the SDK.

How to pass it correctly into the Convert method.

Whether additional flags (nFlags) or parameters (pParams) are required to enable the built-in progress UI.

Whether the parent window handle (hWndParent) must be supplied for the progress dialog to appear.

If possible refer me to some sample code where IProgressMon is used as a parameter that would be a great help.

Thank You.
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Anushka wrote: Tue Jan 20, 2026 1:19 pm Hello PDF-XChange SDK team,

In reference to this convert PDF implementation:
I am using the IPXV_ExportConverter::Convert method to convert PDFs to Word, Excel, and PowerPoint formats. The method signature I am working with is:

Code: Select all

IPXV_ExportConverter::Convert(
    IPXV_Inst*         pInst,
    IPXC_Document*     pSrc,
    IUnknown*          pDest,
    ULONG              nFlags,
    ICab*              pParams,
    IProgressMon*      pProgress,
    HANDLE_T           hWndParent,
    IPXV_PagesRegions* pSelPages,
    IUnknown*          pReserved
);

I specifically need guidance on how to correctly use the IProgressMon parameter (pProgress).

My goals are:

Display the default PDF-XChange progress bar during long conversions (e.g., large PDFs being converted to Word/Excel/PowerPoint).

Ensure the progress dialog includes a Cancel button that allows the user to abort the conversion process.

At present, I am unsure of:

How to properly instantiate or obtain an IProgressMon object.

Whether I should implement my own IProgressMon class or use a built-in one from the SDK.

How to pass it correctly into the Convert method.

Whether additional flags (nFlags) or parameters (pParams) are required to enable the built-in progress UI.

Whether the parent window handle (hWndParent) must be supplied for the progress dialog to appear.

If possible refer me to some sample code where IProgressMon is used as a parameter that would be a great help.

Thank You.
Hello Support Team,
Any update on this ?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2474
Joined: Thu Jun 30, 2005 4:11 pm

Re: convert to excel

Post by Vasyl - PDF-XChange »

Hi Anushka.

You just need this:

Code: Select all

IProgressMon prog = PXV_Inst.ProgressMon; // represents built-in progress dialog
HANDLE_T hwndParent = 0; //represents the HWND-handle of the window which is currently active in your app(your modal dlg for example), 
// when zero is specified - the SDK will try to get it automatically..

conv.Convert(..., prog, wndParent, ... )
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Code: Select all

If (Inst1.ExportConverter(i).ID = "conv.exp.office.docx") Then
    cov = Inst1.ExportConverter(i)
    Dim cab As PDFXEdit.ICab = Inst1.GetFormatConverterParams(False, cov.ID)
    Dim prog As IProgressMon = Inst1.ProgressMon
    Dim hwndParent = Me.Handle
    System.IO.Directory.CreateDirectory(strpath & "\" & strguid)
    Dim fsInst As PDFXEdit.IAFS_Inst = CType(Inst1.GetExtension("AFS"), PDFXEdit.IAFS_Inst)
    Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(strpath & "\" & strguid & "\" & System.IO.Path.GetFileNameWithoutExtension(strfilepath) & ".docx") 
    Dim openFileFlags As Int16 = CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_CreateAlways Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead Or AFS_OpenFileFlags.AFS_OpenFile_Write Or AFS_OpenFileFlags.AFS_OpenFile_FullCache)
    Dim destFile As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(name, openFileFlags)
    cov.Convert(Inst1, Doc, destFile, 0, cab, prog, 0, Nothing, Nothing)

End If
Hi the solution you provided in the previous response i tried it but its not working for me. I have attached the code that I am using. Kindly tell me what I am doing wrong here?
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Anushka wrote: Fri Jan 23, 2026 6:33 am

Code: Select all

If (Inst1.ExportConverter(i).ID = "conv.exp.office.docx") Then
    cov = Inst1.ExportConverter(i)
    Dim cab As PDFXEdit.ICab = Inst1.GetFormatConverterParams(False, cov.ID)
    Dim prog As IProgressMon = Inst1.ProgressMon
    Dim hwndParent = Me.Handle
    System.IO.Directory.CreateDirectory(strpath & "\" & strguid)
    Dim fsInst As PDFXEdit.IAFS_Inst = CType(Inst1.GetExtension("AFS"), PDFXEdit.IAFS_Inst)
    Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(strpath & "\" & strguid & "\" & System.IO.Path.GetFileNameWithoutExtension(strfilepath) & ".docx") 
    Dim openFileFlags As Int16 = CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_CreateAlways Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read Or PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead Or AFS_OpenFileFlags.AFS_OpenFile_Write Or AFS_OpenFileFlags.AFS_OpenFile_FullCache)
    Dim destFile As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(name, openFileFlags)
    cov.Convert(Inst1, Doc, destFile, 0, cab, prog, 0, Nothing, Nothing)

End If
Hi the solution you provided in the previous response i tried it but its not working for me. I have attached the code that I am using. Kindly tell me what I am doing wrong here?
Hello Support Team Any update related to this?? Also in code Inst1 is the PXV Instance and i am passing my current form's handle as parent handle. I have also tried passing 0 which you told is the default but still did not work for me. Kindly explain me what is wrong here?

Thank you.
User avatar
Sean - PDF-XChange
Site Admin
Posts: 664
Joined: Wed Sep 14, 2016 5:42 pm

Re: convert to excel

Post by Sean - PDF-XChange »

Hi Anushka,

I've given the team a nudge on this.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2474
Joined: Thu Jun 30, 2005 4:11 pm

Re: convert to excel

Post by Vasyl - PDF-XChange »

Hi Anushka,

Have you PDF-XChangeEditor ActiveX control embedded and visible on your form? What exactly is not working for you? It does the job, but without the progress window?

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Vasyl - PDF-XChange wrote: Wed Jan 28, 2026 1:31 am Hi Anushka,

Have you PDF-XChangeEditor ActiveX control embedded and visible on your form? What exactly is not working for you? It does the job, but without the progress window?

Cheers.
Hi
So my control is not embedded on the form i.e. its not visible on my form. Also yes the job of conversion is done without the Progress window.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2474
Joined: Thu Jun 30, 2005 4:11 pm

Re: convert to excel

Post by Vasyl - PDF-XChange »

Perhaps the main reason why the progress doesn't show - because you call cov.Convert() in the same thread where the PXV_Inst was instantiated. Please try to call cov.Convert() in the separate thread...
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2474
Joined: Thu Jun 30, 2005 4:11 pm

Re: convert to excel

Post by Vasyl - PDF-XChange »

For this you may use the PXV_Inst::AsyncDoAndWaitForFinish for a simple implementation of IOperation object

Code: Select all

MyOp : IOperation
{
     int ID = 0; 
     ICab Params = null; 
     COMThreadingModel = COMThreadingModel_Any
     ShowSetupUI = empty
     CreateInputItem = empty

     Do()
     { 
           ...
           ov.Convert(...Inst.ProgressMon....) ;
     } 
};
AsyncDoAndWaitForFinish - will execute that MyOp::Do in the separate working thread...

===

Also I recommend you to use PXV_Inst::SetMainWIndow(form.handle) - then form.handle window will be used as a parent of various modal-dialogs which can be displayed by Editor SDK in some cases (doc opening/creation/modification operations, their ShowSetupUI, etc)
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Anushka
User
Posts: 8
Joined: Thu Nov 27, 2025 7:33 am

Re: convert to excel

Post by Anushka »

Vasyl - PDF-XChange wrote: Wed Jan 28, 2026 6:36 am For this you may use the PXV_Inst::AsyncDoAndWaitForFinish for a simple implementation of IOperation object

Code: Select all

MyOp : IOperation
{
     int ID = 0; 
     ICab Params = null; 
     COMThreadingModel = COMThreadingModel_Any
     ShowSetupUI = empty
     CreateInputItem = empty

     Do()
     { 
           ...
           ov.Convert(...Inst.ProgressMon....) ;
     } 
};
AsyncDoAndWaitForFinish - will execute that MyOp::Do in the separate working thread...

===

Also I recommend you to use PXV_Inst::SetMainWIndow(form.handle) - then form.handle window will be used as a parent of various modal-dialogs which can be displayed by Editor SDK in some cases (doc opening/creation/modification operations, their ShowSetupUI, etc)
Hello Support Team,

As per the above reply, and taking reference from the following thread:
viewtopic.php?p=146921&hilit=IOperation ... 68#p146921

I have implemented the IOperation interface in my VB.NET project and attempted to execute it using AsyncDoAndWaitForFinish() as suggested.

However, when calling AsyncDoAndWaitForFinish(), I encounter the following exception:
System.InvalidCastException: 'Unable to cast COM object of type 'PDFXEdit.PXV_InstClass' to interface type 'PDFXEdit.IPXV_Inst'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D726366D-34D6-49FC-A341-7B84C54CCA3E}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE)).'
The custom operation works when executed directly via Op.Do(), but fails when executed through AsyncDoAndWaitForFinish().

My goal is to display the default PDF-XChange progress bar (with the built-in Cancel button) during the conversion process.

Could you please share a small sample project or working C#/VB.NET example demonstrating the correct implementation of IOperation with AsyncDoAndWaitForFinish() and Inst.ProgressMon for this purpose?

Thank you!