Change comma to dot

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

Change comma to dot

Postby ahlesen » 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

Re: Change comma to dot

Postby Betsy.jiang » 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: 1425
Joined: Tue Sep 06, 2016 8:30 am

Re: Change comma to dot

Postby Betsy.jiang » 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: 1425
Joined: Tue Sep 06, 2016 8:30 am

Re: Change comma to dot

Postby ahlesen » 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 5 times
ahlesen
 
Posts: 2
Joined: Mon Aug 21, 2017 8:34 am

Re: Change comma to dot

Postby Betsy.jiang » 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: 1425
Joined: Tue Sep 06, 2016 8:30 am

Re: Change comma to dot

Postby Betsy.jiang » 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: 1425
Joined: Tue Sep 06, 2016 8:30 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 1 guest