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

Free Support Forum - aspose.com

Workbook Replace is case-sensitive

I am currently testing v4.8.1 of aspose.cells. One thing i came across is that the .Replace method off of the workbook class seems to be case-sensitive which presents an issue for us. we are doing a merge field type thing where we search for specific names surrounded in brackets and replace those with actual data. The application doing the replacing always looks for a lower-cased name but unfortunately users don't always setup the excel template like that and will capitalize the field names. aspose.word has the same method off of the document class and it seems to be case-insensitive from my testing, so i'm thinking that aspose.cells should behave the same? is this a bug? maybe all 3 of your products should have a .Replace method where either its always case-insensitive or at least has an overload to determine case-sensitive or not?

Example code that fails to replace with the attached excel doc:

Workbook wb = new Workbook();
wb.Open(inputName);
wb.Replace("[b_officialname]", "Awesome Agency");

wb.Save(outputName);

Hi,

Well, Workbook.Replace is case-sensitive method by default. We will enhance the feature to support it to include “Match case” (Case sensitivity/Case insensitivity options) for your need.
Your issue has been logged into our our issue tracking system with an issue id: CELLSNET-12212.

Thank you.

Hi,

Please try the attached version. margin: 0pt;
font-family: Arial,Verdana,Tahoma;
font-size: 12px;
}
.footer { color:Gray; font-size: 11px; text-align: center; }
.back1 { background-color: whitesmoke; }
.back2 { background-color: #f1f5e1; }
.back3 { background-color: cornsilk; }

We have supported this feature. See following
code:

Workbook wb = new Workbook();
wb.Open(inputName);
ReplaceOptions options = new ReplaceOptions();
options.IsCaseSensitive = false;
wb.Replace("[b_officialname]", "Awesome Agency", options);



Thank you.

that version only seems to replace text in the cell if that cell only contains the text i am looking for. we have cells that have additional text or maybe even multiple merge fields and those are not replaced. see attached example excel file. in this example, only the first two cells are replaced with the text i want. the next 3 cells contain either multiple merge fields or additional text and those cells are ignored. I would expect that a function called Replace would replace text regardless of other text around it.

thoughts?


Hi,

Thank you for considering Aspose.

We will look into your required feature and et back to you soon. Your requirement has been registered into our issue tracking system with issue id CELLSNET-12489.

Thank You & Best Regards,

Hi,

Please try the attached version.


p
{
margin: 0pt;
font-family: Arial,Verdana,Tahoma;
font-size: 12px;
}
.footer { color:Gray; font-size: 11px; text-align: center; }
.back1 { background-color: whitesmoke; }
.back2 { background-color: #f1f5e1; }
.back3 { background-color: cornsilk; }

We have provided a new property i.e…,
ReplaceOptions.MatchEntireCellContents to support your need. See following
code:
Workbook workbook = new Workbook();
workbook.Open( "test.xls");
ReplaceOptions replace = new ReplaceOptions();
replace.IsCaseSensitive = false;
replace.MatchEntireCellContents = false;
workbook.Replace("[b_phone]", "123123123", replace);
workbook.Save("dest.xls");


Thank you.

that fixed it. thanks!

The issues you have found earlier (filed as 12212) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.