⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repoedit.pas

📁 一个报表控件TRepoEdit
💻 PAS
📖 第 1 页 / 共 5 页
字号:
         then  ThReport.page.WIDTH:=strtofloat(Values[Names[i]])
         else If upperCase(Names[i])='PAGE.ORIENTATION'
         then  ThReport.page.Orientation:=TPrinterOrientation(GetInt(Values[Names[i]]))
         else If upperCase(Names[i])='PAGE.PAPERSIZE'
         then  ThReport.page.PaperSize:=TQRPAPERSIZE(GetInt(Values[Names[i]]))
         else If upperCase(Names[i])='PAGE.RULER'
         then  ThReport.page.RULER:=GetBool(Values[Names[i]])
         else If upperCase(Names[i])='PAGE.COLUMNS'
         then  ThReport.page.Columns:=GetInt(Values[Names[i]])

         else If upperCase(Names[i])='PRINTERSETTINGS.COPIES'
         then  ThReport.PrinterSettings.Copies:=Getint(Values[Names[i]])
         else If upperCase(Names[i])='PRINTERSETTINGS.FIRSTPAGE'
         then  ThReport.PrinterSettings.Firstpage:=getint(Values[Names[i]])
         else If upperCase(Names[i])='PRINTERSETTINGS.LASTPAGE'
         then  ThReport.PrinterSettings.LASTPAGE:=GetInt(Values[Names[i]])
         else If upperCase(Names[i])='PRINTERSETTINGS.OUTPUTBIN'
         then  ThReport.PrinterSettings.OutputBin:=TQRBIN(GetInt(Values[Names[i]]))
         else If upperCase(Names[i])='PRINTERSETTINGS.DUPLEX'
         then  ThReport.PrinterSettings.DUPLEX:=GetBool(Values[Names[i]])
         else If upperCase(Names[i])='SNAPTOGRID'
         then  ThReport.SNAPTOGRID:=GetBool(Values[Names[i]])
         else If upperCase(Names[i])='PRINTIFEMPTY'
         then  ThReport.PRINTIFEMPTY:=getBool(Values[Names[i]])
         else If upperCase(Names[i])='UNITS'
         then  ThReport.Units :=TQRUnit(getInt(Values[Names[i]]));
     end;
///////////

     with Tareport do begin
       First;
       locate('NameForm',CorrectName,[]);

       while not EOF and (TaRepNAMEFORM.asString=CorrectName) do begin

           ThName:=FieldByname('NAMECOMPONENT').AsString;
           ThVal:=0;
           if pos(':',Thname)<>0 then begin
              ThVal:=strtoint(copy(ThName,pos(':',Thname)+1,10));
              ThName:=copy(ThName,1,pos(':',Thname)-1);
           end;

           clear;
           SetText(pchar(TaRepValue.Value));

           if ThVal=CurrentVariant then  begin
             ThComp:=MainWin.FindComponent(ThName);
             if (ThComp=nil) and (pos('New_',ThName)=1) then begin
                                         //NewComponent
                Str:=Values['TYPE'];
                if Str='' then thComp:=nil
                else begin
                  if Str='TQRBAND' then begin
                    thComp:=TQRBAND.Create(self.MainWin);
                    (thComp as TQRBand).ParentReport:=self.ThReport;
                    (thComp as TQRBand).Parent:=Self.ThReport; // TWinControl
                    ThComp.Name:=thName;
                  end
                  else begin
                    Str2:=Values['PARENT'];

                    if Str2='' then  thComp:=nil
                    else begin
                      ParentComp:=MainWin.FindComponent(Str2);
                      if ParentComp=nil then ThComp:=nil
                      else begin
                        if Str='TQRLABEL' then begin
                          thComp:=TQRLabel.Create(self.mainWin);
                          (thComp as TQRLabel).ParentReport:=self.ThReport;
                          (thComp as TQRlabel).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRDBTEXT' then begin
                          thComp:=TQRDBText.Create(self.MainWin);
                          (thComp as TQrDBText).ParentReport:=self.ThReport;
                          (ThComp as TQRDBText).DataSet:=self.ThReport.dataSet;
                          (thComp as TQRDBTEXT).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQREXPR' then begin
                          thComp:=TQREXPR.Create(self.MainWin);
                          (thComp AS TQREXPR).ParentReport:=self.ThReport;
                          (thComp as TQREXPR).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRSYSDATA' then begin
                          thComp:=TQRSYSDATA.Create(self.MainWin);
                          (thComp AS TQRSYSDATA).ParentReport:=self.ThReport;
                          (thComp as TQRSYSDATA).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRMEMO' then begin
                          thComp:=TQRMEMO.Create(self.MainWin);
                          (thComp as TQRMEMO).ParentReport:=self.ThReport;
                          (thComp as TQRMEMO).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRIMAGE' then begin
                          thComp:=TQRIMAGE.Create(self.MainWin);
                          (thComp as TQRIMAGE).ParentReport:=self.ThReport;
                          (ThComp as TQRIMage).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRDBIMAGE' then begin
                          thComp:=TQRDBIMAGE.Create(self.MainWin);
                          (thComp as TQRDBimage).ParentReport:=self.ThReport;
                          (thComp as TqrDBImage).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRSHAPE' then begin
                          thComp:=TQRSHAPE.Create(self.MainWin);
                          (thComp as TQRShape).ParentReport:=self.ThReport;
                          (thComp as TQRshape).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                        else  if Str='TQRRICHTEXT' then begin
                          thComp:=TQRRICHTEXT.Create(self.Mainwin);
//                          (thComp as TQRRICHTEXT).CanFocus:=false;
                          (thComp as TQRRICHTEXT).ParentRichEdit:=nil;
                          (thComp as TQRRichText).ParentReport:=self.ThReport;
                          (thComp as TQRRichText).Parent:=TWinControl(ParentComp); // TWinControl
                          ThComp.Name:=thName;
                        end
                      end
                    end
                  end
                end;
             end;

             if (ThComp<>nil) and (ThComp is TCustomControl) then begin
                if Not (ThComp is TQuickRep) then begin

                   if (ThComp is TQRCustomlabel) then  (ThComp as TQRCustomLabel).AutoSize:=false
                   else if (ThComp is TQRImage) then  (ThComp as TQRImage).AutoSize:=false;

                   if not fieldByname('TOP').IsNULL then
                      (ThComp as TCustomControl).Top:=FieldByName('TOP').AsInteger;
                   if not fieldByname('LEFT').IsNULL then
                      (ThComp as TCustomControl).LEFT:=FieldByName('LEFT').AsInteger;
                   if not fieldByname('WIDTH').IsNULL then
                      (ThComp as TCustomControl).Width:=FieldByName('WIDTH').AsInteger;
                   if not fieldByname('HEIGHT').IsNULL then
                      (ThComp as TCustomControl).HEIGHT:=FieldByName('HEIGHT').AsInteger;
                   if (not (ThComp is TQRBasepanel)) and (not fieldByname('ENABLED').IsNULL) then
                      (ThComp as TCustomControl).Enabled:=FieldByName('ENABLED').AsBoolean;
                   if ((ThComp is TQRBasepanel)) and (not fieldByname('ENABLED').IsNULL) then
                      (ThComp as TqrBasePanel).Enabled:=FieldByName('ENABLED').AsBoolean;
                end;


                if Not (ThComp is TQRBasePanel) then begin
                  if not FieldbyName('NotFrontBack').IsNULL then begin
                    if FieldByname('NotFrontBack').AsInteger=1
                    then (ThComp as TCustomControl).BringToFront
                    else if FieldByname('NotFrontBack').AsInteger=2
                    then (ThComp as TCustomControl).SendToBack;
                  end;
                end;

                if ThComp is TQrPrintable then begin

                   if not fieldByname('Frame.Color').IsNULL
                   then     (ThComp as TQRPrintable).Frame.Color:=TColor(FieldByName('Frame.Color').AsInteger);

                   if not fieldByname('Frame.DrawBottom').IsNULL
                   then     (ThComp as TQRPrintable).Frame.DrawBottom:=FieldByName('Frame.DrawBottom').AsBoolean;
                   if not fieldByname('Frame.DrawLeft').IsNULL
                   then     (ThComp as TQRPrintable).Frame.DrawLeft:=FieldByName('Frame.DrawLeft').AsBoolean;
                   if not fieldByname('Frame.DrawTop').IsNULL
                   then     (ThComp as TQRPrintable).Frame.DrawTop:=FieldByName('Frame.DrawTop').AsBoolean;
                   if not fieldByname('Frame.DrawRight').IsNULL
                   then     (ThComp as TQRPrintable).Frame.DrawRight:=FieldByName('Frame.DrawRight').AsBoolean;
                   if not fieldByname('Frame.Width').IsNULL
                   then     (ThComp as TQRPrintable).Frame.Width:=FieldByName('Frame.Width').AsInteger;
                   if not fieldByname('Frame.Style').IsNULL
                   then     (ThComp as TQRPrintable).Frame.Style:=TPenStyle(FieldByName('Frame.Style').AsInteger);

                   if Values['BRUSH.COLOR']<>''
                   then (ThComp as TQrPrintable).Brush.Color:=TColor(getint(Values['BRUSH.COLOR']));

                   if Values['BRUSH.STYLE']<>''
                   then (ThComp as TQrPrintable).Brush.Style:=TBrushStyle(GetInt(Values['BRUSH.STYLE']));

                   if (ThComp is TQRCustomlabel) then begin
                     if not FieldByname('Color').IsNull
                     then (ThComp as TQRCustomLabel).Color:=TColor(FieldByname('Color').AsInteger);
                     if not FieldByname('Alignment').IsNull
                     then (ThComp as TQRCustomLabel).Alignment:=TAlignment(FieldByname('Alignment').AsInteger);
                     if not FieldByname('AutoSize').IsNull
                     then (ThComp as TQRCustomLabel).AutoSize:=FieldByname('AutoSize').AsBoolean;
                     if not FieldByname('Stretch').IsNull
                     then (ThComp as TQRCustomLabel).AutoStretch:=FieldByname('Stretch').AsBoolean;

                     if not FieldByname('Font.Charset').IsNull
                     then (ThComp as TQRCustomLabel).Font.Charset:=TFontCharSet(FieldByname('Font.Charset').AsInteger);

                     if not FieldByname('Font.Color').IsNull
                     then (ThComp as TQRCustomLabel).Font.Color:=TColor(FieldByname('Font.Color').AsInteger);

                     if not FieldByname('Font.Height').IsNull
                     then (ThComp as TQRCustomLabel).Font.Height:=FieldByname('Font.Height').AsInteger;

                     if not FieldByname('Font.Name').IsNull
                     then (ThComp as TQRCustomLabel).Font.Name:=FieldByname('Font.Name').AsString;

                     if not FieldByname('Font.Pitch').IsNull
                     then (ThComp as TQRCustomLabel).Font.Pitch:=TFontPitch(FieldByname('Font.Pitch').AsInteger);

                     if not FieldByname('Font.Size').IsNull
                     then (ThComp as TQRCustomLabel).Font.Size:=FieldByname('Font.Size').AsInteger;


                     if not FieldByname('WordWrap').IsNull
                     then (ThComp as TQRCustomLabel).WordWrap:=FieldByname('WordWrap').AsBoolean;

                     ThFSt:=[];

                     if FieldByname('Font.Style.IsBold').AsBoolean then ThFst:=ThFST+[fsBold];

                     if FieldByname('Font.Style.IsItalic').AsBoolean then  ThFst:=ThFST+[fsItalic];

                     if FieldByname('Font.Style.IsUnderline').AsBoolean then  ThFst:=ThFST+[fsUnderLine];

                     if FieldByname('Font.Style.IsStrikeOut').AsBoolean  then ThFst:=ThFST+[fsStrikeOut];

                     (ThComp as TQRCustomLabel).Font.Style:=ThFST;

                     if thComp is TQRlabel then begin
                       if not FieldByname('Transparent').IsNull
                       then (ThComp as TQRLabel).Transparent:=FieldByname('Transparent').AsBoolean;

                       if Values['CAPTION']<>''
                       then (ThComp as TQRlabel).Caption:=VALUes['CAPTION'];
                     end
                     else if thComp is TQRDBText then begin
                       if not FieldByname('Transparent').IsNull
                       then (ThComp as TQRDBText).Transparent:=FieldByname('Transparent').AsBoolean;

                       if VALUES['MASK']<>''
                       then (ThComp as TQRDBText).MASK:=VALUES['MASK'];
                       if VALUES['FIELD']<>''
                       then (ThComp as TQRDBText).DataField:=VALUES['FIELD'];
                     end
                     else if thComp is TQRMemo then begin
                       if not FieldByname('Transparent').IsNull
                       then (ThComp as TQRMemo).Transparent:=FieldByname('Transparent').AsBoolean;

                       ThFileName:=VALUES['LINES'];
                       SetDopparam(ThComp,'LINES',ThFileName);
                       if (ThFileName<>'') and FileExists(ThFileName) then
                           try
                             (ThComp as TQRMemo).LINES.clear;
                             (ThComp as TQRMemo).LINES.LoadFromFile(thfileName);
                           except
                             on E:exception do
                               bvMessError('Cannot open file!'+#13+
                                'Message:'+e.Message);
                           end;
                     end
                     else if thComp is TQRExpr then begin
                       if not FieldByname('Transparent').IsNull
                       then (ThComp as TQRExpr).Transparent:=FieldByname('Transparent').AsBoolean;

                       if VALUES['MASK']<>''
                       then (ThComp as TQREXPR).MASK:=VALUES['MASK'];

                       if VALUES['EXPRESSION']<>''
                       then (ThComp as TQREXPR).Expression:=VALUES['EXPRESSION'];

                       if VALUES['RESETAFTERPRINT']<>''
                       then (ThComp as TQREXPR).ResetAfterPrint:=GetBool(VALUES['RESETAFTERPRINT']);

                     end
                     else if thComp is TQRSysData then begin
                       if not FieldByname('Transparent').IsNull
                       then (ThComp as TQRSysData).Transparent:=FieldByname('Transparent').AsBoolean;
                       if VALUES['TEXT']<>''
                       then (ThComp as TQRSysData).Text:=VALUES['TEXT'];
                       if VALUES['DATA']<>''
                       then (ThComp as TQRSysData).DATA:=TQRSysDataType(GetInt(VALUES['DATA']));
                     end

                   end
                   else if (ThComp is TQRCustomRichText) then begin
                     if not FieldByname('Font.Charset').IsNull
                     then (ThComp as TQRCustomRichText).Font.Charset:=TFontCharSet(FieldByname('Font.Charset').AsInteger);
                     if not FieldByname('Font.Color').IsNull
                     then (ThComp as TQRCustomRichText).Font.Color:=TColor(FieldByname('Font.Color').AsInteger);
                     if not FieldByname('Font.Height').IsNull
                     then (ThComp as TQRCustomRichText).Font.Height:=FieldByname('Font.Height').AsInteger;
                     if not FieldByname('Font.Name').IsNull
                     then (ThComp as TQRCustomRichText).Font.Name:=FieldByname('Font.Name').AsString;
                     if not FieldByname('Font.Pitch').IsNull
                     then (ThComp as TQRCustomRichText).Font.Pitch:=TFontPitch(FieldByname('Font.Pitch').AsInteger);
                     if not FieldByname('Font.Size').IsNull
                     then (ThComp as TQRCustomRichText).Font.Size:=FieldByname('Font.Size').AsInteger;
                     ThFSt:=[];
                     if FieldByname('Font.Style.IsBold').AsBoolean then ThFst:=ThFST+[fsBold];
                     if FieldByname('Font.Style.IsItalic').AsBoolean then  ThFst:=ThFST+[fsItalic];
                     if FieldByname('Font.Style.IsUnderline').AsBoolean then  ThFst:=ThFST+[fsUnderLine];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -