//create a new workbook Workbook workbook = new Workbook(); // This option is valid when culture is ja-JP or zh-CN. workbook.setCulture(Locale.JAPANESE); ; IWorksheet worksheet = workbook.getWorksheets().get(0); // Prepare data worksheet.getRange("A1:A4") .setValue(new String[] { "Mario Games", "スーパーマリオブラザーズ", "マリオ&ルイージRPG3 DX", "マリオ&ルイージRPG1 DX" }); // Find the first cell that contains "マリオ" (match width) // and mark it with red foreground. IRange searchRange = worksheet.getUsedRange(); FindOptions matchByteOptions = new FindOptions(); matchByteOptions.setMatchByte(true); IRange marioCell = searchRange.find("マリオ", null, matchByteOptions); marioCell.getFont().setColor(Color.GetRed()); // Find the first cell that contains "ルイージ" (ignore width) // and mark it with green background. IRange luigiCell = searchRange.find("ルイージ"); luigiCell.getInterior().setColor(Color.GetGreen()); //save to an excel file workbook.save("FindMatchByte.xlsx");
//create a new workbook var workbook = Workbook() // This option is valid when culture is ja-JP or zh-CN. workbook.culture = Locale.JAPANESE val worksheet = workbook.worksheets.get(0) // Prepare data worksheet.getRange("A1:A4").value = arrayOf("Mario Games", "スーパーマリオブラザーズ", "マリオ&ルイージRPG3 DX", "マリオ&ルイージRPG1 DX") // Find the first cell that contains "マリオ" (match width) // and mark it with red foreground. val searchRange = worksheet.usedRange val matchByteOptions = FindOptions() matchByteOptions.matchByte = true val marioCell = searchRange.find("マリオ", null, matchByteOptions) marioCell.font.color = Color.GetRed() // Find the first cell that contains "ルイージ" (ignore width) // and mark it with green background. val luigiCell = searchRange.find("ルイージ") luigiCell.interior.color = Color.GetGreen() //save to an excel file workbook.save("FindMatchByte.xlsx")