Page 1 of 2

Conversion of Excel file with empty sheet fails

Posted: Thu Dec 05, 2013 7:03 am
by ahsan
Hi,
Conversion of Excel file with empty sheet fails. The problem is in setting "batchProcessing".

Code: Select all

 IBatchProcessingOptions batchProcessing = p2fServer.DefaultBatchProcessingOptions;
                  batchProcessing.ExcelOptions.SkipEmptySheets = true;
                  batchProcessing.ApplyChanges();
                  p2fServer.ConvertFile(inputPath, outputPath, settingProfile, batchProcessing, null);
if i do not pass "batchProcessing", then there is no failure. :)

Error is:

System.Runtime.InteropServices.COMException: Before printing timeout expired
at Print2Flash3.IServer.ConvertFile(String SourceFileName, String OutputFileName, Object Profile, Object BatchProcessingOptions, Object PrintingPreferences)

Re: Conversion of Excel file with empty sheet fails

Posted: Thu Dec 05, 2013 8:23 am
by staff
Could you send a sample Excel document with which you experience this problem to our support e-mail so that we can investigate it?

Re: Conversion of Excel file with empty sheet fails

Posted: Thu Dec 05, 2013 9:49 am
by ahsan
Thanks for reply.
ANy excel file with an empty sheet will cause this problem. Anyhow, file is attached,it is having an empty sheet.

Re: Conversion of Excel file with empty sheet fails

Posted: Thu Dec 05, 2013 11:50 pm
by staff
We converted this document with your script without any problems. So the problem must be in your computer configuration.

First, try to convert your document with Batch Processing Application. If it can be converted with it, it means that there is something wrong with your script or options saved previously. If so, try to delete Print2Flash options stored on your computer. To accomplish this, delete the following registry key: HKEY_CURRENT_USER\Software\Print2Flash\Print2Flash3.

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 1:37 am
by ahsan
If I just remove the empty sheets from excel file, then all is fine with the same code. But the problem of skipping empty sheets still exist(as it is functional requirement).

Basically, the problem is of "timeout" on call of "p2fServer.ConvertFile" function. It become unresponsive until timeout. File is so small and there is no issue of large file.

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 1:48 am
by staff
Were you able to convert this file with Batch Processing Application? Did you try to clear the data from that registry key?

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 2:05 am
by ahsan
The excel file is being converted fine with the Print2Flash Commercial 64 bit (Edition 3.5).
But I am unable to convert it using C# code.

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 2:21 am
by staff
To clear the data from a registry key is very easy. You need to:
  • Launch Registry Editor by clicking Windows Start button, choosing Run..., typing regedit and pressing Enter key
  • Open the following node in the tree on the left: HKEY_CURRENT_USER\Software\Print2Flash\Print2Flash3
  • Select that node and press Del key
After you delete that data, try to convert your Excel document with your C# code again.

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 4:02 am
by ahsan
I did the steps and file is converted successfully. Then I added another empty sheet, saved it and converted but conversion failed. I did the conversion again and file converted.

So, after adding a new empty sheet it fails first time but second time it succeeded.

I am writing a plugin for office.

Re: Conversion of Excel file with empty sheet fails

Posted: Fri Dec 06, 2013 5:35 am
by staff
Can you convert documents successfully when SkipEmptySheets is false? What are you trying to accomplish with SkipEmptySheets property? The fact is this property is not documented and it is better not to use it.
Also, if you invoke document conversions from inside an Office plug-in and have access to Excel's Workbook object, it is better to convert using printing jobs rather than ConvertFile method.