How do I set the style for an entire worksheet, preferably at the point of creation, i.e. before writing to it? For example, I don’t know how many rows or columns I will have to import at runtime, but I want them all have the same font. Along the same line, how do you set a default style for the whole workbook, such that any new worksheets could inherit it?
Victor
Hi,
I think you may use Workbook.get/setDefaultStyle() method for your needs.
See the example below:
The following code creates and instantiates a new Workbook and sets a default Style to it.
Sample code:
Workbook workbook = new Workbook();
Style defaultStyle = workbook.getDefaultStyle();
defaultStyle.getFont().setName(“Tahoma”);
workbook.setDefaultStyle(defaultStyle);
Also, see the documents in the section:
Many thanks!
Have a nice weekend!
Hi,
You are welcome. We also wish you a nice weekend.
If you encounter any other issue, please feel free to post on our forums, we will be glad to assist you further.