Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Dec 22, 2017 2:56 pm

Hello

In attached file, value of cell J8 is calculated incorrectly. It must show 4.35 but it shows 2.35

Thanks

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Mon Dec 25, 2017 1:48 am

Hello,

Thanks for your post. I did not find the attachment. Please zip your document and upload it.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Dec 25, 2017 7:27 am

File is attached
Attachments
DB84080A-8AB9-49AB-A607-0367D6A7F73ABook1.zip
(23.76 KiB) Downloaded 242 times

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Mon Dec 25, 2017 8:35 am

Hello,

Thanks for your sharing. After an initial test with the latest version(Spire.XLS Pack Hotfix Version:7.12.125), I was unable to reproduce the issue. To help us investigate further, please share us with your full code and a screen shot that showing the wrong number is preferred.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Dec 25, 2017 9:44 pm

Hello

You are right, it was my mistake during conversion of "4 7/ 20" to a double number. And here it is the point: we have 3 spaces between 4 and 7 and one space after / and before 20. Is this combination of spaces always present in string? I need to work with text because I need to extract unit and formatting from numbers if any and text of number is the way I have used from the beginning.

And here let me ask you another question: in cell F13, how can I get font color and background color.

thanks.

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Tue Dec 26, 2017 3:46 am

Hello,

Thank for your feedback. Please refer to the below code snippet to accomplish your task.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(fileName,ExcelVersion.Version2010);
            //change the number format into double
            workbook.Worksheets[0].Range["J8"].NumberFormat = "0.00";

            //get conditional back color and font color
            var con = workbook.Worksheets[0].Range["F13"].ConditionalFormats[0];
            var cBackc = con.BackColor;
            var cFillc = con.FontColor;

            ////get normal back color and font color
            //var nFontc = workbook.Worksheets[0].Range["F13"].Style.Font.Color;
            //var nFillc = workbook.Worksheets[0].Range["F14"].Style.Color;

            workbook.SaveToFile("result.xlsx");


Best regards,
Simon
E-iceblue support team
Last edited by Simon.yang on Fri Jan 26, 2018 1:42 am, edited 1 time in total.
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Dec 28, 2017 6:16 am

Hello,

Greeting from E-iceblue.
Is the code snippet I provided helpful to you?
Your feedback will be greatly appreciated.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Jan 25, 2018 3:14 pm

Hello

Sorry I had missed this post. Yes, it was helpful.

Regars

ahmadi_rad@yahoo.com
 
Posts: 43
Joined: Thu Apr 13, 2017 3:53 pm

Fri Jan 26, 2018 1:42 am

Hello,

Thanks for your reply. If there is any other question, welcome to contact us.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.XLS