Hi Adrian,
is there a function in TXlsFile that can give me the length of a string in terms of Excel internal units.
I need find out if a string needs one or two rows in an Excel file.
Hi Adrian,
Well, first of all, the usual caveats apply: you can't get the exact length because Excel shows different stuff depending in the resolution.
uses ... FlexCel.Pdf...
...
var
ColWidthInPixels, ColWidthInPoints: double;
PdfWriter: TPdfWriter;
TextWidth: TUISize;
Font: TUIFont;
begin
ColWidthInPixels := xls.GetColWidth(1, true) / TExcelMetrics.ColMult(xls);
ColWidthInPoints := ColWidthInPixels / 96.0 * 72.0;
PdfWriter := TPdfWriter.Create;
try
Font := TUIFont.CreateNew('Arial', 12, [TUIFontStyle.fsBold]);
try
TextWidth := PdfWriter.MeasureString('hellomylov', Font);
finally
Font.Free;
end;
finally
PdfWriter.Free;
end;
Thanks a lot Adrian for the comprehensive explanation.