소스 검색

Export pdf: same with Export xls

MaiXinRong 9 년 전
부모
커밋
fa1c5cb69a
2개의 변경된 파일21개의 추가작업 그리고 17개의 파일을 삭제
  1. 13 7
      Reports/UI/ScReportsFrm.dfm
  2. 8 10
      Reports/UI/ScReportsFrm.pas

+ 13 - 7
Reports/UI/ScReportsFrm.dfm

@@ -25,14 +25,14 @@ object ScReportsForm: TScReportsForm
     Left = 260
     Top = 81
     Width = 5
-    Height = 713
+    Height = 720
     AutoSnap = False
     OnMoved = Splitter1Moved
   end
   object xdcTop: TdxBarDockControl
     Left = 0
     Top = 0
-    Width = 1446
+    Width = 1454
     Height = 81
     Align = dalTop
     BarManager = xmReports
@@ -41,8 +41,8 @@ object ScReportsForm: TScReportsForm
   object ScrollBox1: TScrollBox
     Left = 265
     Top = 81
-    Width = 1181
-    Height = 713
+    Width = 1189
+    Height = 720
     HorzScrollBar.Increment = 48
     HorzScrollBar.Tracking = True
     VertScrollBar.Increment = 32
@@ -168,7 +168,7 @@ object ScReportsForm: TScReportsForm
     Left = 0
     Top = 81
     Width = 260
-    Height = 713
+    Height = 720
     Align = alLeft
     Caption = 'Panel1'
     TabOrder = 6
@@ -176,7 +176,7 @@ object ScReportsForm: TScReportsForm
       Left = 1
       Top = 36
       Width = 258
-      Height = 676
+      Height = 683
       Align = alClient
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -257,7 +257,7 @@ object ScReportsForm: TScReportsForm
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Height = -12
-    Font.Name = #24494#36719#38597#40657
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Bars = <
       item
@@ -3047,4 +3047,10 @@ object ScReportsForm: TScReportsForm
       8001800180018001FFFFFFFFFFFFFFFF00000000000000000000000000000000
       000000000000}
   end
+  object sdOutputPdf: TSaveDialog
+    Filter = 'Pdf'#25991#20214'(*.xls)|*.xls|'#25152#26377#25991#20214'(*.*)|*.*'
+    Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing]
+    Left = 208
+    Top = 168
+  end
 end

+ 8 - 10
Reports/UI/ScReportsFrm.pas

@@ -101,6 +101,7 @@ type
     xlbToHeadExcel: TdxBarLargeButton;
     tbRemoveSelection: TToolButton;
     chkShowUpperNum: TCheckBox;
+    sdOutputPdf: TSaveDialog;
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure xlbCloseClick(Sender: TObject);
     procedure FormResize(Sender: TObject);
@@ -1642,17 +1643,16 @@ begin
             //directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True);
             if (isFirst) then
             begin
-              strOutputFile := Format('%s%s.pdf', [FHistoryOutputPdfPath, FReportManager.FieldValue['名称']]);
-              if GetSaveFileName(strOutputFile, 'PDF文件|*.pdf', '.pdf') then
+              sdOutputPdf.FileName := FReportManager.FieldValue['名称'];
+              if sdOutputPdf.Execute then
               begin
                 isFirst := False;
-                FHistoryOutputPdfPath := ExtractFilePath(strOutputFile);
-                directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True, False, oemNormal, strOutputFile, '', chkExcel2010.Checked);
+                directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True, False, oemNormal, sdOutputPdf.FileName, '', chkExcel2010.Checked);
               end;
             end
             else
             begin
-              strOutputFile := FHistoryOutputPdfPath + FReportManager.FieldValue['名称'] + '.pdf';
+              strOutputFile := ExtractFilePath(sdOutputPdf.FileName) + FReportManager.FieldValue['名称'] + '.pdf';
               directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True, False, oemNormal, strOutputFile, '', chkExcel2010.Checked);
             end;
           end;
@@ -1677,13 +1677,11 @@ begin
       intEndPage := StrToInt(xcbEndPage.Text);
       if (intStartPage>0) and (intEndPage <= PreviewComXML.TotalPages) then
       begin
-        strOutputFile := Format('%s%s.pdf', [FHistoryOutputPdfPath, PreviewComXML.ReportName]);
-        if GetSaveFileName(strOutputFile, 'PDF文件|*.pdf', '.pdf') then
+        sdOutputPdf.FileName := PreviewComXML.ReportName;
+        if sdOutputPdf.Execute then
         begin
-          FHistoryOutputPdfPath := ExtractFilePath(strOutputFile);
-          PdfHelper.ExportPages(PreviewComXML, strOutputFile, intStartPage, intEndPage);
+          PdfHelper.ExportPages(PreviewComXML, sdOutputPdf.FileName, intStartPage, intEndPage);
         end;
-        //PreviewComXML.PrintPDF(PreviewBox.Canvas, intStartPage, intEndPage);
       end;
     finally
       Screen.Cursor := crDefault;