استبدال النص في مصنف باستخدام التعبير العادي
Contents
[
Hide
]
يوفر Aspose.Cells خاصية لاستبدال نص في مصنف باستخدام تعبير عادي. لهذا ، يوفر APIRegexKeyممتلكاتReplaceOptionsصف دراسي. وضعRegexKeyإلىحقيقييشير إلى أن المفتاح الذي تم البحث عنه سيكون تعبيرًا عاديًا.
يوضح مقتطف الشفرة التالي استخدام ملفRegexKeyالملكية باستخدامنموذج ملف اكسل. الملف إلاخراجتم إنشاؤها بواسطة مقتطف الشفرة التالي مرفق كمرجع.
عينة من الرموز
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// directories | |
String sourceDir = Utils.Get_SourceDirectory(); | |
String outputDir = Utils.Get_OutputDirectory(); | |
Workbook workbook = new Workbook(sourceDir + "SampleRegexReplace.xlsx"); | |
ReplaceOptions replace = new ReplaceOptions(); | |
replace.setCaseSensitive(false); | |
replace.setMatchEntireCellContents(false); | |
// Set to true to indicate that the searched key is regex | |
replace.setRegexKey(true); | |
workbook.replace("\\bKIM\\b", "^^^TIM^^^", replace); | |
workbook.save(outputDir + "RegexReplace_out.xlsx"); |