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 May 13, 2021 5:05 am
How do I make the text of all merged cells bold in a sheet (except merged cells with a specific text say, "Abc")?
-
Tamal_007
-
- Posts: 2
- Joined: Thu May 13, 2021 4:53 am
Thu May 13, 2021 6:40 am
Hello,
Thanks for your inquiry.
Please refer to the following code to meet your requirement.
- Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("test.xlsx");
Worksheet sheet = workbook.Worksheets[0];
CellRange[] mergeCells = sheet.MergedCells;
foreach (CellRange mergeCell in mergeCells)
{
if (!mergeCell.CellList[0].Value.Contains("Abc"))
{
mergeCell.Style.Font.IsBold = true;
}
}
String result = "Result.xlsx";
workbook.SaveToFile(result, ExcelVersion.Version2013);
If there are any issues, just feel free to contact us.
Sincerely,
Brian
E-iceblue support team
-
Brian.Li
-
- Posts: 1271
- Joined: Mon Oct 19, 2020 3:04 am
Thu May 13, 2021 7:05 am
Thanks for your quick answer
-
Tamal_007
-
- Posts: 2
- Joined: Thu May 13, 2021 4:53 am
Thu May 13, 2021 9:13 am
You are welcome.
If you have any other questions while using our products, just feel free to contact us.
Sincerely,
Brian
E-iceblue support team
-
Brian.Li
-
- Posts: 1271
- Joined: Mon Oct 19, 2020 3:04 am