ShowExcelPreview procedure
Prototype: |
procedure ShowExcelPreview(const Options:string); |
|
Description: |
Shows thumbnail preview. File can be printed, exported to pdf or saved to excel afterwards. |
|
Syntax: |
xls.ShowExcelPreview(Options); |
|
Part |
Description |
|
xls |
Variable declared as an instance of the TExcelWrapper class |
|
Options |
Variable declared as string that specifies possibilities to switch on / off the Options menu items of the preview window. SaveToExcelFile=1 : Switch on the "Save to file" menu item of the preview window. OpenInExcel=1 Switch on the "Open in Excel" menu item of the preview window. |
|
Return value: |
none |
|
See also:
OpenFile, FileName, CloseAndSave, OpenInExcel, Complex example
Example:
Var
xls :TExcelWrapper;
Begin
{data preparation}
//data querying etc...
{document preparation}
xls:=TExcelWrapper.Create;
try
xls.CreateFile(ProjectDir+'ExcelTasks\MyExcelTask');
{managing worksheets}
{managing formats}
{setting cell values}
{etc....}
try
xls.CloseAndSave(true); // save and open file in Excel
{or
xls.ShowExcelPreview('OpenInExcel=0;SaveToExcelFile=0'); // show thumbnail preview
or
xls.CloseAndSave(false); // save file in Excel
xls.OpenInExcel(FileName); // open file in Excel
}
except
ShowError('Error on saving file.');
end;
finally
xls.Free;
end;
End.
© 2024 IFER-Monitoring and Mapping Solutions