Free Support Forum - aspose.com

Reading of Bold Data from an excel file

Hi all,

I need a small help.I have one excel file. I want to read that excel file. I want to read only bold data(The data which is in bold case letters) from that file and write it into another excel file.

please help me which method and class should i use

Thanking you in advance,

Regards,

Bertha.

Hi Bertha,

I think you may try to loop through all the rows and columns in a worksheet and utilize ...Font.isBold() boolean method in conditional control flow of struct to manually check each cell's style if it has bold text and then insert this data into your other workbook provided the method returns true.

Thank you.

Hi Bertha,

Loop through all rows and columns is time-consuming if your file is very large. A better way is to loop through cell in cells collection. For example:

Workbook wb = new Workbook();

wb.LoadData(fileName); //Because you only care about data and formattings, you can use LoadData method which is a little faster than Open method

Cells cells = wb.Worksheet[0].Cells;

for(int i = 0; i < cells.Count; i ++)

{

Cell cell = cells[i];

if(cell.Style.Font.IsBold)

{

//Clear formats to facilitate GC

cell.Style = null;

//Copy cell data to another workbook

...

}

}