Free Support Forum -

Applying a Style to a CellArea and Retrieving a CellArea populated by Smart Tags

Is it possible when given a CellArea to apply a style to that cell area only?

Also, it would be convenient if there was a method to call to retrieve the cell area that the smart tag populated.

This would allow me to

1) retrieve the cellarea populated from the smart tag. then

2) apply a style to that cellarea.



Well, I think you may use Cells.createRange() method to create a range based on your desired CellArea. Now create a style object with your desired formatting attributes, then apply the style to that named range, see the topic for your reference:

Regarding your query i.e. “retrieve the cellarea populated from the smart tag”. Do you need to get the cells range when the smart markers are processed., well, here you have to use your own code and may try to use the following methods to get the cells range, e.g
Cells.getMaxDataRow()/getMaxRow, Cells.getMaxDataColumn()/getMaxColumn().
Also, you may try to use the code segment, e.g:
Range range = worksheet.getCells().getMaxDisplayRange();
it will give you a range based on the data in the whole worksheet, which you may later apply style to that range. By the way, if you are using smart markers tags in the template Excel file, you may just format/apply style manually in MS Excel to those cells, so when the markers are processed, the filled data cells would be automatically formatted.

thank you.