Free Support Forum - aspose.com

Bug in ICustom paramsList : wrong paramter type

Hi,

In the attach workbook and code to the reproduce the bug I've,

You can see that an element in ICustomFunction is of unknow type instead of being of type double

Type "x27763" instead of a double

Aspose.Cells version : 4.8.2.0

Thanks for your help

Hi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample code.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our internal issue tracking system with issue id: CELLSNET-14883.

Thank You & Best Regards,

Hi Aspose Team,

Any news on this issue?

I need to go in production next Monday for the project where the issue appear.
Can you provide the fix this week?

Thanks for your help

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We will provide a fix for the issue by the end of this week.

Thank you for being patient.

Hi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please try the attached latest version of Aspose.Cells. We have fixed your mentioned issue in ICustomFunction parameter list.

Thank You & Best Regards,

Hi,

I have installed your updates and now when I want to build my solution in VIsual studio I get the following error message :

Error 9 'Aspose.Cells.FileFormatType' does not contain a definition for 'AsposePdf' E:\acbaASP_projetVS\App_Code\StaticClass\acbaPDF.cs 43 51 E:\acbaASP_projetVS\

Thanks for your help

Samuel

Hi Samuel,

Well, I tested the latest version with your sample code and template file and I did not find any issue. Please create a sample application with the latest version of Aspose.Cells to reproduce the issue and post it here. We will check it soon.

Thank You & Best Regards,

Hi,

Well, we eliminated the older member “AsposePdf” from FileFormatType enumeration: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/aspose.cells.fileformattype.html , the reason is we have provided a direct way (that is more efficient and accurate) to convert an excel file to pdf format without using the intermediate step with Aspoe.Pdf for .NET, see the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-to-pdf-files.html

Please do use new approach to convert the files to pdf format, if you have any issue related to it, kindly let us know and we will check it soon.

Thank you.

When I try to convert the workbook with the fix you provided.
The pdf is not generated.
Can you help me with this?
This is urgent, I need this for today.

MemoryStream pdfStream = new MemoryStream();
testWorkbook.Save(pdfStream, FileFormatType.Pdf);
byte[] pdfByteArray = pdfStream.GetBuffer(); //the byte array here as no element

*Version : 4.8.2.10

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample code.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue have been registered in our internal issue tracking system with issue id: CELLSNET-15126.

Thank You & Best Regards,

Please, give me the delay untill the release of the fix.
I've committement to fullfill.
Without the timeframe, I won't be able to preserve any face.

Hi,

We will provide you the fixed version within 3-4 days

Thank you.

Thank you for the delay.
I appreciate it.

Hi,

Please try the attached version, we have fixed your mentioned issue. And, please use MemoryStream.ToArray() instead of MemoryStream.GetFuffer(). If you use MemoryStream.GetFuffer(), you might get a corrupted pdf file.

Here is my test code:

Workbook workbook = new Workbook();
workbook.Open(“e:\test\Mybook.xlsx”);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, FileFormatType.Pdf);
ms.Seek(0, SeekOrigin.Begin);
byte[] buffer = new byte[ms.Length];
buffer = ms.ToArray();
MessageBox.Show(ms.Length.ToString()); //It provides me the length.
FileStream fs = new FileStream(“e:\test\MyPdfFile.pdf”, FileMode.Create);
fs.Write(buffer, 0, buffer.Length);
fs.Close();
ms.Close();


Thank you.

Thank you for the fix.

I've test it with the attach workbook and the resulting pdf as too much pages
The pdf as over 3000 pages, but it should be 2 pages.
Sometimes, I even get a OutOfMemory exception.

The legacy pdf conversion method had a way to determine where the excel sheet ends.
Can you had this feature?
Or is there a workaround?
Please note that i can't setup print area as I don't know in advance how many data will be pull into the workbook.

Here is my code :

string testWorkbookFilePath= @"your path" ;
string resultingPdfFilePath = @"your path" ;

Workbook testWorkbook = new Workbook();
testWorkbook.Open(testWorkbookFilePath);
MemoryStream pdfStream = new MemoryStream();
testWorkbook.Save(pdfStream, FileFormatType.Pdf);
byte[] pdfByteArray = new byte[pdfStream.Length];
pdfByteArray = pdfStream.ToArray();

FileStream pdfFile = new FileStream(resultingPdfFilePath, FileMode.Create);
pdfFile.Write(pdfByteArray, 0, pdfByteArray.Length);
pdfFile.Close();
pdfStream.Close();

Hi,

Well, I have checked your template excel file. Using MS Excel’s print preview (PageSetup option), I can confirm it has over 2600 pages for the second worksheet and over 3000 pages for the third worksheet. Aspose.Cells will print/render all the pages (whether they have data or not) that are displayed in Print Preview in MS Excel by default. Moreover, if you could take a look the PageSetup dialog box opening the file in MS Excel, you will see that there are two reasons for this huge pages list.

1). Click the Sheet tab in Page Setup Dialog in MS Excel, you will see there are print areas set extensively for the second and the third worksheets, e.g
(i) A1:I65535 for the second worksheet.
(ii) A1:J65535 for the third worksheet.

2) Click the Sheet tab in Page Setup Dialog in MS Excel, you will see a value is given for the “Rows to repeat at top” for the second and the third worksheets, i.e.:
$8:$11 for the second and the third worksheets.

So, when you will convert from the spreadsheets to Pdf file format, long list of pages would be rendered in the pdf document. Also, the process would be time consuming and will use extra memory to be completed. I think you need to set the Print areas and “Rows to repeat at top” accordingly to minimize your pages.

For reference, please see the document:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-print-options.html


Thank you.

I can’t define the printed area upfront
As data are pulled in the workbook at runtime,
I have no way to know how much the user will want to pull

I understand that the printed area should be define dynamically at runtime
Can you provide code to do this?

As this problem didn’t occur with the legacy method.
I guess it has some algorithm to discard empty pages.

Thanks in advance.

Hi,

Well, I think for your case, you just remove the existing print area settings, it will work fine. When you remove the print area settings, MS Excel would only print that area in the sheet which has data in it, so the extra pages won’t be rendered in the Pdf format.

See the following sample code:

string testWorkbookFilePath= @“your path” ;
string resultingPdfFilePath = @“your path” ;

Workbook
testWorkbook = new Workbook();
testWorkbook.Open(testWorkbookFilePath);
MemoryStream pdfStream = new MemoryStream();

foreach (Worksheet ws in testWorkbook.Worksheets)
{
ws.PageSetup.PrintArea = “”;

}

testWorkbook.Save(pdfStream, FileFormatType.Pdf);
byte[] pdfByteArray = new byte[pdfStream.Length];
pdfByteArray
= pdfStream.ToArray();

FileStream pdfFile = new FileStream(resultingPdfFilePath, FileMode.Create);
pdfFile.Write(pdfByteArray, 0, pdfByteArray.Length);
pdfFile.Close();
pdfStream.Close();


Also as I told you earlier you can specify Page Setup/Printing options if you want, please see the document:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-print-options.html


Thank you.

The issues you have found earlier (filed as 15126) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.