We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Difference between Cell.PutValue(string) and Cell.PutValue(string- bool)

Hello,

Just wondering what the differences between Cell.PutValue(string) and Cell.PutValue(string, bool) are. Here’s the relevant page from the documentation:

Cell.PutValue(string) and Cell.PutValue(string, bool)

Calling the function like this:

cell.PutValue("(test)");

will work fine, but calling the function like this:

cell.PutValue("(test)", true);

will do nothing. Note the parenthesis around “(test)” these are required to reproduce this. In older versions of Aspose.Cells either of these functions would insert the value, but we recently updated to the most recent version, and now only the former works. Before we remove the second argument, we want to know why this change was made, and what the repercussion are.

I have attached a sample visual studio 2010 project to illustrate.

Hi,

Thanks for your posting.

One will insert a text and other will convert the text into number before inserting it if possible.

For example the following code inserts 2 as a text in cell A1 but 2 as a number in cell A2

Please see the output file generated by the following code (attached).

C#


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Cell A1 = worksheet.Cells[“A1”];

Cell A2 = worksheet.Cells[“A2”];


A1.PutValue(“2”); //Will write text 2

A2.PutValue(“2”, true); //Will write number 2


workbook.Save(“f:\shak-data-rw\downloads\output.xlsx”, SaveFormat.Xlsx);