Hi,
I encounter error 'Microsoft Office Excel did not find anything to print' while trying to 'print preview' generated file in xls format.
Error will not emerge if the file extension is .xlsx.
Right click the generated worksheet, select move and copy then cancel will enable the print preview but my client won't accept this solution and they also don't want to print in xlsx format.
Please help.
Thanks.
Microsoft Office Excel did not find anything to print
Re: Microsoft Office Excel did not find anything to print
Hello
I can't reproduce this. Please provide more info about the file you try to print.
I can't reproduce this. Please provide more info about the file you try to print.
Lars Arvidsson, Axolot Data
Re: Microsoft Office Excel did not find anything to print
Hi Larsa,
I use below procedure to automate the creation worksheet(s).
Then I call it as below:
The problem is because I remove (delete) the default worksheet 'Sheet1' because I expect the generated excel file will only contain the worksheet '201401' until '201412'.
Did i miss anything while deleting 'Sheet1'?
Please help.
Thanks.
I use below procedure to automate the creation worksheet(s).
Code: Select all
procedure XLSRWDefineWorkSheet(const workSheetName: array of string; bDeletedSheet1: Boolean = True);
var
loop, subLoop, nWorkSheetIndex: integer;
isWorkSheetExist: Boolean;
begin
nWorkSheetIndex := XLSRW.Count - 1;
// add worksheet if no of workSheetName more than 0
if (high(workSheetName) >= 0) then
begin
for loop := 0 to high(workSheetName) do
begin
isWorkSheetExist := False;
if Trim(workSheetName[loop]) <> '' then
begin
for subLoop := 0 to nWorkSheetIndex do
if Trim(XLSRW[subLoop].Name) = Trim(workSheetName[loop]) then
isWorkSheetExist := True;
if (not isWorkSheetExist) then
begin
nWorkSheetIndex := nWorkSheetIndex + 1;
XLSRW.Add;
XLSRW[nWorkSheetIndex].Name := Trim(workSheetName[loop]);
end;
end;
end;
end;
if bDeletedSheet1 then
begin
isWorkSheetExist := False;
for subLoop := 0 to nWorkSheetIndex do
if Trim(XLSRW[subLoop].Name) = 'Sheet1' then
isWorkSheetExist := True;
if isWorkSheetExist then
XLSRW.Delete(XLSRW.SheetByName('Sheet1').Index, 1);
end;
end;
Code: Select all
var
XLSRW: TXLSReadWriteII5;
loop: integer;
begin
XLSRW.Version := xvExcel97;
for loop := 201401 to 201412 do
XLSRWDefineWorkSheet([IntToStr(loop)]); // expect to create worksheets '201401' until '201412'
// write to excel and formatting ....
XLSRW.SaveToFile(templatePath);
end;
Did i miss anything while deleting 'Sheet1'?
Please help.
Thanks.
Re: Microsoft Office Excel did not find anything to print
Hi Larsa,
Any update?
Thanks.
Any update?
Thanks.
Re: Microsoft Office Excel did not find anything to print
Hello
As you don't add any cell values in your sample, there is nothing to print.
As you don't add any cell values in your sample, there is nothing to print.
Lars Arvidsson, Axolot Data