|
@@ -10,7 +10,7 @@ interface
|
|
|
uses
|
|
|
ProjectData, ScFileArchiver, ReportManager, ConditionalDefines,
|
|
|
PrintComTypeDefUnit, ADODB, DB, ReportPrepare, ReportConnection,
|
|
|
- AuditSelectFrm,
|
|
|
+ AuditSelectFrm, ExcelOutput,
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, PrintCom, PrintComXML, ExtCtrls, ExTreeView, ImgList,
|
|
|
dxBarExtItems, dxBar, ComCtrls, ToolWin, StdCtrls, Jpeg;
|
|
@@ -159,6 +159,7 @@ type
|
|
|
function GetPrecededCount: Integer;
|
|
|
function GetExcelMode: TOutputExcelMode;
|
|
|
function GetIsExcel2010: Boolean;
|
|
|
+ function GetSysTempDirectory : String;
|
|
|
public
|
|
|
destructor Destroy; override;
|
|
|
procedure RefreshReportTemplets;
|
|
@@ -1460,20 +1461,39 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+function TReportsForm.GetSysTempDirectory : String;
|
|
|
+var TempDir : array[0..255] of Char;
|
|
|
+begin
|
|
|
+ GetTempPath(255, @TempDir);
|
|
|
+ Result := StrPas(TempDir);
|
|
|
+end;
|
|
|
+
|
|
|
procedure TReportsForm.ExportXlsReport(AStartPage, AEndPage: Integer;
|
|
|
const AFileName: string; APrintCom: TPrintComXML);
|
|
|
|
|
|
procedure ExportPagesXlsReport(AStartPage, AEndPage: Integer; const AFileName: string);
|
|
|
var
|
|
|
Border : TColumnLineRec;
|
|
|
+ themeFile, tmpPath : string;
|
|
|
begin
|
|
|
LoadExcelBorder(Border);
|
|
|
if IsExcel2010 then
|
|
|
+ begin
|
|
|
+ (*
|
|
|
APrintCom.OutputToExcelFileOE(PreviewBox.Canvas, AStartPage, AEndPage, AFileName, ExcelMode, Border, nil)
|
|
|
- else
|
|
|
+ (*)
|
|
|
+ //用新方法处理
|
|
|
+ themeFile := ExtractFilePath(Application.ExeName) + 'Data\theme1.xml';
|
|
|
+ tmpPath := GetSysTempDirectory;
|
|
|
+ APrintCom.buildOutputData(PreviewBox.Canvas, AStartPage, AEndPage, Border);
|
|
|
+ ExcelOutput.outputAsExcel(APrintCom.OutputData, APrintCom.PageSize, (excelMode = oemOneSheet), tmpPath, themeFile, AFileName, nil);
|
|
|
+ //*)
|
|
|
+ end else
|
|
|
+ begin
|
|
|
//APrintCom.OutputToExcelFile(PreviewBox.Canvas, AStartPage, AEndPage, GetTemplateXlsFileName, AFileName, ExcelMode, Border);
|
|
|
APrintCom.OutputToExcelFileOE(PreviewBox.Canvas, AStartPage, AEndPage, AFileName, ExcelMode, Border, nil);
|
|
|
//现2010格式与之前格式应用同一控件导出
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
var
|