Supressing Warning Messages in the generated Excel File

Hi

We persist the data in Excel File from Aspose. As we need to have custom format on the number column, we have set the number column as String. The excel File is generated perfectly. But it shows the warning messages (to convert the number). Client doesn't want to have the warning message.

We just want to know, is there anyway to suppress the warning messages in the Aspose. The sample file is attached for your reference.

Thanks in advance.

Thanks
Srini

Hi Srini,

Thanks for considering Aspose.

Well, you may try the following overloaded version of the PutValue method of Cell class while inserting the values:

i.e., Cell.PutValue(string stringvalue, bool isConverted)............please use true for isConverted parameter.

Thank you.

Hi Amjad Sahi,

Thank you very much for the reply.

We dont see there is a method putValue(String value, boolean isConverted) in the cell object.

But We find setValue(String value, boolean isconverted). We have used this with isConverted is true. The comments were suppressed. But whatever we have formated in the string value is lost. If isConverted is false, we get the warning messages.

Thanks
Srini

Hi,

Well, I think you may try to set number formats for your requirements.

E.g.,

.

.

Style style = cell.getStyle();

style.setCustom("0.0000");

cell.setStyle(style);

For further reference, please check: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/setting-display-formats-of-numbers-dates.html

Thank you.

Hi,

Thank you very much for your prompt reply.

As per the approach that you have mentioned, we are able to achive the requirement. But this solution wont fit into our application, the reasons are as follows

1. We have very huge amount of cell to be filled. If we are setting style for each Cell, it will be a performance hit.

2. As per our application requirement, we have to export the data from aspose to HTML page (viewed through the on line), PDF Files and Excel Files. So we are populating the data in the aspose cell itself. When we extract the data from aspose as a string for the formated value and populate the excel, the warning message are appearing.

I wanted to know how to correct the warning messages through aspose or how to ignore the warning messages.

Thanks
Srini

Hi Srini,

Excel file store string and numeric values in different ways. For example, "0" is different with 0. So when you put a string "0" to an Excel file, warning message are appearing.

To remove the mesage, you have to use Amjad's solution: convert the string to number and set the number format as you expected.

Another way is to change the option in your MS Excel: Tools->Options->Error Checking->uncheck "Number stored as text" option.

hi Laurence,
is there any option to set in Codebehind . i am using asp.net i want to set that setting for all downloads in code not for individual template

Hi,

I think you are talking about Application level settings, e.g., In MS Excel, click Tools|Options|.... in the Options dialog box, click Error Checking tab.... Number stored as Text (checkbox), well, these types of info are stored in MS Excel Application and not with the .xls file, so, you have to do it individually for each file using the related Aspose.Cells APIs, check the postes above for reference.

Thank you.