This code creates a sheet with a demostration code for different row height
calculation methods.
uses
{...}, OExport, OExport_Vcl, OExport_VclForms;
procedure TForm1.BtnTestClick(Sender: TObject);
var
xExport: TOExport;
I, L: Integer;
const
Text =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '+
'Quisque id odio turpis, vulputate faucibus '+
'dolor. Suspendisse rutrum pretium dolor ut aliquet. '+
'Vivamus ultrices, tortor vel venenatis scelerisque, nunc '+
'sem condimentum arcu, ut viverra odio tellus ut odio. Sed a '+
'fringilla nunc. Curabitur eleifend neque eget nisl '+
'gravida gravida. Sed porta dapibus turpis, sit amet eleifend '+
'orci dictum sed. Nulla facilisi. Morbi '+
'condimentum massa commodo elit sollicitudin cursus.';
begin
xExport := TOExport.Create;
try
with xExport.AddWorkSheet('RowHeight Calculation') do begin
Cols[0].Width := 150;
Cols[1].Width := 300;
AddRow.AddCellString(Title).SetFontSize(20);
AddRow;
with AddRow do begin
AddCellString('Text without word wrap').SetFontStyle([fsBold]);
end;
with AddRow do begin
AddCellString('Font.Size = 12');
AddCellString(Text).SetFontSize(12);
end;
with AddRow do begin
AddCellString('Font.Size = 15');
AddCellString(Text).SetFontSize(15);
end;
with AddRow do begin
AddCellString('Font.Size = 25');
AddCellString(Text).SetFontSize(25);
end;
AddRow;
with AddRow do begin
AddCellString('Text with word wrap').SetFontStyle([fsBold]);
end;
with AddRow do begin
AddCellString('Single line');
AddCellString(Text).SetWrapText.SetCalculateRowHeight(erhSingleLine);
end;
with AddRow do begin
AddCellString('Multi line');
AddCellString(Text).SetWrapText.SetCalculateRowHeight(erhMultiLine);
end;
with AddRow do begin
AddCellString('Multi line over ColSpan');
AddCellString(Text).SetWrapText.SetColSpan(3).SetCalculateRowHeight(erhMultiLine);
end;
with AddRow do begin
AddCellString('Auto row height');
AddCellString(Text).SetWrapText.SetCalculateRowHeight(erhForceAuto);
end;
end;
xExport.SaveToFileWithDialog;
finally
xExport.Free;
end;
end;