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.

Thu Aug 31, 2017 1:22 pm

Hi, how can i find comma and change it to dot in a cell in excel file?

Thanks,
Andrey

ahlesen
 
Posts: 2
Joined: Mon Aug 21, 2017 8:34 am

Fri Sep 01, 2017 2:23 am

Dear Andrey,

Thanks for your inquiry.
Please use Replace method. Code snippet:
Code: Select all
workbook.Replace(",", ".");

If there is any question, please provide input document for investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Sep 05, 2017 9:23 am

Dear Andrey,

Did you test the code I provided ? Has your issue been resolved ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 06, 2017 3:48 pm

Dear Betsy,

I tried to change comma to dot in columns rate 1 and 2
with part of code

for (int i = 1; i <= sheet.LastRow; i++)
{
sheet.Range[i, 1].Text.Replace(",", ".");
sheet.Range[i, 2].Text.Replace(",", ".");
}

but I didn't see anything new

Thanks,
Andrey
Attachments
1.zip
(6.52 KiB) Downloaded 276 times

ahlesen
 
Posts: 2
Joined: Mon Aug 21, 2017 8:34 am

Fri Sep 08, 2017 2:59 am

Dear ahlesen,

Thanks for your feedback.
In your code, please reset the value to the range after replacing. Here is sample code for your kind reference.
Code: Select all
            for (int i = 1; i <= sheet.LastRow; i++)
            {
                string text = sheet.Range[i, 1].Value;
                string textN = text.Replace(",", ".");
                sheet.Range[i, 1].Value= textN;
            }

If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Sep 15, 2017 8:52 am

Dear ahlesen,

Did you test the code I provided ? Has your issue been resolved ?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS

cron