[]
Implement this interface when you need to provide custom text measurement information for workbook layout calculations.
class CustomGraphicsInfo implements IGraphicsInfo {
@Override
public double getDigitWidth(TextFormatInfo textFormat) {
if ("Calibri".equals(textFormat.getFontFamily())) {
return 8 * textFormat.getFontSize() / 11;
}
return 7 * textFormat.getFontSize() / 11;
}
}
IGraphicsInfo graphicsInfo = new CustomGraphicsInfo();
workbook.setGraphicsInfo(graphicsInfo);
doublegetDigitWidth(TextFormatInfo textFormat) Use this method in a custom IGraphicsInfo implementation to return the digit width used by workbook layout calculations for the supplied text format.
IGraphicsInfo graphicsInfo = new IGraphicsInfo() {
@Override
public double getDigitWidth(TextFormatInfo textFormat) {
if ("Calibri".equals(textFormat.getFontFamily())) {
return 8 * textFormat.getFontSize() / 11;
}
return 7 * textFormat.getFontSize() / 11;
}
};
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontFamily("Calibri");
textFormat.setFontSize(11);
double digitWidth = graphicsInfo.getDigitWidth(textFormat);
textFormat - The text format used to measure the digits.