Problem referencing negative formatting


#1

I am using Aspose.Excel to read in Excel files and compare the cells to numbers in a report from another application. Each cell in the speadsheet is compared to the corresponding cell in the report. The cells much match exactly including all formatting otherwise an exception is returned.

I am using the StringValue property to get the cell value and all formatting in order to compare to the report cell. (ws.Cells(“B3”).StringValue) My problem is that the negative format for the cell is not there when I read the cell contents using the StringValue property. So (11) in Excel is -11 when I reference this StringValue property. The comma formatting is fine though. 5,100 is returned as 5,100 just fine.

Please advise. Thanks.


#2

Could you please post your file to show this problem? I am not very sure about it.

And could you try to use Cell.IntValue and Cell.DoubleValue property to comare the values?


#3

Its pretty easy to duplicate. Just type -11 into a cell in MS Excel and then format the cell as a number (1,234). I attached a sheet with this in it. I have tried all the properties I could find including IntValue and DoubleValue. These won’t work because they strip out the formatting. The cell in Excel reads (11) and ws.Cells(“A1”).StringValue returns -(11).


#4

Please try this fix.


#5

Wow, I got through!! I have been unable to reply to this post all day. I kept getting “request timed out” and “general network” errors.

I still get the same problem with this fix.

Is there a faster way to work through a problem when using aspose software?


#6

Wow, I got through!! I have been unable to reply to this post all day. I kept getting “request timed out” and “general network” errors.

I still get the same problem with this fix.

Is there a faster way to work through a problem when using aspose software? I tried the email addresses but they got kicked back…


#7

Quick notice.

Today our forums are experiencing slow access or even timeout. We have reported to our hosting and they finally fixed it.

Definitely the forums are the quickest way to get our support. Your latest experience has tought us that we should have a way to make sure the forums should be 99% up. I will discuss with our web hosting. Thanks for your reporting and tolerance.


#8

I tried your test.xls and all worked fine in the new fix.

Excel excel = new Excel();
excel.Open(“d:\test.xls”);
Console.WriteLine(excel.Worksheets[0].Cells[“a1”].StringValue);

It returns (11.00).

Does this new fix work for your posted file?

Thank you.


#9

I am getting junk with the test file. I attached three screen prints of what I am seeting. The first is the test file. You can see some random encryped string being returned. The second is my original worksheet that shows the -11. The third is a copy of that file with sensitive information stripped out. I also attached this third file which also returns -11.

I am running Excel 2003 on Windows 2000.


#10

About the random string, it’s a license warning mark. Please check http://www.aspose.com/Wiki/default.aspx/Aspose.Excel/GarbageTextInWorksheet.html
for reference.

In cell k44, StringValue property returns -11. Could you please upload your file just with that cell? I will check the format of that cell.

The attached file is my template. To avoid this random string in cell A1, I add another dummy cell.


#11

Sorry. I am confused. It sounds like you were able to duplcate the problem where cell k44 returns -11 instead of (11). Is that correct? Then what else do you need exactly?


#12
  1. The random text is a license mark. Please check http://www.aspose.com/Wiki/default.aspx/Aspose.Excel/GarbageTextInWorksheet.html
    for reference.

    2. In my place, negative value returns correctly with the new fix. Does the error still occur in your place? If yes, could you please post your file and sample code? Thank you.

#13

Attached is a sample project that reads in the myfile.xls file. You may have to change the directory to the file and/or the .webinfo file. Also in the zip is a picture of what is returned when I run this code here (untitled.bmp). It returns -11 not (11) when cell k44 is queried. Also, in the \bin directory, you will notice that I am using the 5/23 aspose.excel.dll file.


#14

We purchased the software using the id “dashboard” this morning. To resolve this issue, we are working with a hot fix dated 5/23. Do I need a licensed version of this file now?


#15

After you buy the license, you can download the license file. Please check http://www.aspose.com/wiki/default.aspx/Aspose.Purchase/HowToDownloadLicense.html
for reference.

I tried you program and K44 returns “-11”. It’s the correct result, right?


#16

No. It should not be -11. When I look at the cell in Excel, it looks this way

(11)

When I read it in Aspose, it returns

-11

This is my problem. Its the negative formatting.


#17

But K44 does show -11 in my place. Please see the attached screenshot.



#18

The same cell shows as (11) in my Excel 2003 (attached). I wonder if its an Excel version problem. I tried specifying "FileFormatType.Excel2003" as the second parameter to the Excel.Open method but there was no difference.

What is the number format on the cell (menu->Format\Cells\Number tab)? It should be (1,234). If it isn't, maybe you could change it to this and save. Then try reading it from the Aspose.Excel component. If it is, I wonder why your cell isn't rendering correctly.


#19

Please check the attached file. It’s unzipped from your webapplication1.zip. I don’t change anything in this file.

Could you post your file here?


#20

Both your file and my file (attached) read (11) in Excel and -11 in Aspose. Did you check your number formatting for the cell? I attached a screen print of what my formatting is set to.

BTW, I was able to apply the license that we purchased on my computer just fine. Thanks.