Converting from html to excel showing the large number in scientific format

I am trying to convert my html report to excel using aspose. The html report has large number like (2101214483543270000) showing in excel as (1.10121E+18). Is there a way to show the full number instead of scientific notation? via some global workbook level settings during conversion. Attached both html and excel file.

I am converting using following code
HtmlLoadOptions opts = new HtmlLoadOptions();
opts.setAutoFitColsAndRows(true);
//Create workbook from your HTML string
Workbook wb = new Workbook(new ByteArrayInputStream(htmlFile), opts);
wb.getWorksheets().get(0).setGridlinesVisible(true);
//Save the workbook in output format
ByteArrayOutputStream excelOut = new ByteArrayOutputStream();
wb.save(excelOut, new SpreadsheetML2003SaveOptions(SaveFormat.XLSX));
return excelOut.toByteArray();

Archive.zip (13.6 KB)

@sunithaprabhu,

If you could you open your .html file into MS Excel manually, you will also notice those scientific notations in the column, so it is the behavior of MS Excel and nothing to do with Aspose.Cells API. For your needs, you may try to use setConvertNumericData under LoadOptions to false, it will convert all the numeric data to text. See the sample code for your reference:
e.g
Sample code:

HtmlLoadOptions opts = new HtmlLoadOptions();
		opts.setAutoFitColsAndRows(true);
		opts.setConvertNumericData(false);
		Workbook wb = new Workbook("f:\\files\\report.html", opts);
		wb.getWorksheets().get(0).setGridlinesVisible(true);
		wb.getWorksheets().get(0).autoFitColumn(10);
		wb.save("f:\\files\\out1.xlsx",SaveFormat.XLSX);

Alternatively, you may apply the custom formatting “0” to the specified column (create a Style object with custom formatting, create StyleFlag object and set the numbers formatting on and apply the formatting via Column.applyStyle() method), so it could display complete value instead of scientific notations.

Thanks for your quick response as usual. I just tried the setConvertNumericDAta(false) looking at other posts and it worked. Hope that will not have any side effect.

@sunithaprabhu,

Good to know that the suggested option works for your needs.

I wish Html aspose response time is same as you guys do… I am thrilled with cells support

@sunithaprabhu,

Please wait Aspose.HTML team will address your issue soon for your issues/queries. Sometimes due to other priority tasks on hand, you might get delays but surely you will be updated and your issues would be figure out.

We just got the aspose license finally as this process has been going on for sometime.

Now can you tell me how to use the license to ge the code working… Our maven repo doesn’t seem like having these jars. I have added aspose repository, but still the jars doesn’t seem like visible.

@sunithaprabhu,
See the documents with example code for your reference:

Let us know your feedback.

After adding the 2 lines to set the license, the generated excel from aspose does not have the Evaluation tab which used to be there. But in the main sheet, I still see the 'Evaluation Only notice at the top. Why is that so? Attached the excel
Here is the code
@PostConstruct
public void init(){
com.aspose.cells.License license = new com.aspose.cells.License();
license.setLicense("/lic/Aspose.Total.Product.Family.lic");
}

payment_received_report-1.xlsx.zip (7.6 KB)

@sunithaprabhu,
This issue is reproduced here and is logged in our database for an investigation and fix. We will inform you here about any update in this regard. This issue is logged as follows:

CELLSJAVA-43208 - Trial version warning on first sheet while converting HTML to XLSX using a valid license

Will this be taken care soon as we are licensed user? although this is filed in free support?

Moreover the license is for 2 developers but unlimited deployment . Not sure how does it work. Does it means 2 developers can develop in their local machine and can be deployed in multiple stage environment and prod environment without issues?

We deploy in our stage environments for testing. Hope there is no restriction in the number of environment it gets deployed. Not sure how aspose can figure out if it’s developer machine or stage env in that case. Sorry if it’s lame question… this licensing limitation is new to me

We evaluated your issue further and found it is not an issue with the API rather you somehow generated the html file in evaluation mode as the watermark is there at the top if you simply open your input HTML file into the browser or MS Excel, see the attached screenshot for your reference:
sc_shot1.png (50.5 KB)

PS. you should generate your html file (which you are using as an input file for this scenario/case) in license mode (you may set the license at the start before rendering to HTML file).

Please post your licensing queries in Aspose.Purchase forum and one of our sales staff member will help you soon there.

Html file is generated using the license as we set the license before generating the html

@sunithaprabhu,

Please paste sample code (runnable) with sample files to generate the html file, we will check it soon.

Checking on my side… Meanwhile your doc says add the following dependency for cells. Do we need bouncycastle dependency as well? I haven’t added it

<dependencies>

<dependency>

<groupId>com.aspose</groupId>

<artifactId>aspose-cells</artifactId>

<version> 20.6 </version>

</dependency>

<dependency>

<groupId>com.aspose</groupId>

<artifactId>aspose-cells</artifactId>

<version> 20.6 </version>

<classifier>javadoc</classifier>

</dependency>

<dependency>

<groupId>org.bouncycastle</groupId>

<artifactId>bcprov-jdk15on</artifactId>

<version> 1.60 </version>

</dependency>

@sunithaprabhu,

Yes, it is better to include bouncycastle dependency as well. This dependency would be used when using AES encryption or protection on Excel spreadsheets.

Thanks. The Evaluation watermark doesn’t show up now in Excel.

But in html to pdf conversion it does show up. Attached reports generated with license and without license. I see one watermark is removed in the one generated with license but still other one shows up

pdf_report_without_license.png (20.0 KB)
pdf_report_with_license.png (59.0 KB)

The evaluation watermark above is from Aspose.HTML API and nothing to do with Aspose.Cells. You would also require Aspose.HTML license which needs to be set in the code before using any other Aspose.HTML APIs.

This is ok as you will always get evaluation watermark in evaluation mode (without valid license(s) of the relevant API(s) to be set in code).

Should you have any other issue or queries, feel free to write us back.