Conversion of Excel file with empty sheet fails

Using Batch Processing and Enhanced Batch Processing
ahsan
Posts:34
Joined:Thu Oct 31, 2013 8:41 am
Conversion of Excel file with empty sheet fails

Post by ahsan » Thu Dec 05, 2013 7:03 am

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)

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Conversion of Excel file with empty sheet fails

Post by staff » Thu Dec 05, 2013 8:23 am

Could you send a sample Excel document with which you experience this problem to our support e-mail so that we can investigate it?

ahsan
Posts:34
Joined:Thu Oct 31, 2013 8:41 am

Re: Conversion of Excel file with empty sheet fails

Post by ahsan » Thu Dec 05, 2013 9:49 am

Thanks for reply.
ANy excel file with an empty sheet will cause this problem. Anyhow, file is attached,it is having an empty sheet.
Attachments
sample.rar
it is having an empty sheet.
(5.59KiB)Downloaded 1386 times

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Conversion of Excel file with empty sheet fails

Post by staff » Thu Dec 05, 2013 11:50 pm

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.

ahsan
Posts:34
Joined:Thu Oct 31, 2013 8:41 am

Re: Conversion of Excel file with empty sheet fails

Post by ahsan » Fri Dec 06, 2013 1:37 am

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.

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Conversion of Excel file with empty sheet fails

Post by staff » Fri Dec 06, 2013 1:48 am

Were you able to convert this file with Batch Processing Application? Did you try to clear the data from that registry key?

ahsan
Posts:34
Joined:Thu Oct 31, 2013 8:41 am

Re: Conversion of Excel file with empty sheet fails

Post by ahsan » Fri Dec 06, 2013 2:05 am

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.
Last edited by ahsan on Fri Dec 06, 2013 2:26 am, edited 1 time in total.

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Conversion of Excel file with empty sheet fails

Post by staff » Fri Dec 06, 2013 2:21 am

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.

ahsan
Posts:34
Joined:Thu Oct 31, 2013 8:41 am

Re: Conversion of Excel file with empty sheet fails

Post by ahsan » Fri Dec 06, 2013 4:02 am

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.

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Conversion of Excel file with empty sheet fails

Post by staff » Fri Dec 06, 2013 5:35 am

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.

Post Reply