|

楼主 |
发表于 2009-4-20 15:08:24
|
显示全部楼层
不好意思,我只是觉得问题已经很明确了,代码如下
procedure TArchivsFromExist.SaveSheetPicToStream(ASheetName,ASheetURL: string;AList: TStringList);
var
lBitMap: TBitMap;
lJPG: TJPEGImage;
lWidth,lHeight: Integer;
lSheet: TSheetDoc;
lDocID: string;
lPaperView: TPaperPreView;
lNextbtn: TSpeedButton;
I:Integer;
begin
I := 1;
try
lDocID := SysUtils.UpperCase(ASheetURL);
jsCommon.splitStr(SysUtils.UpperCase(FInfoURL)+'\',lDocID);
FForm.DocView.DocClassID := lDocID;
lSheet := FForm.DocView.Doc as TSheetDoc;
lPaperView := TWinControl(TWinControl(TWinControl(FForm.DocView.Controls[0]).Controls[0]).Controls[2]).Controls[0] as TPaperPreView;
FForm.DocView.Width := lPaperView.Width;
FForm.DocView.Height := lPaperView.Height;
lNextbtn := FForm.DocViewBar.Controls[8] as TSpeedButton;
// Borland.Delphi.Windows.SendMessage(FForm.Handle,Borland.Delphi.Messages.WM_SHOWWINDOW,0,0);
// FForm.DocView.RefreshDoc(True);
FForm.ShowModal;
lBitMap := TBitMap.Create;
lJPG := TJPEGIMage.Create;
lBitMap.Width := lPaperView.PaperWidth;
lBitMap.Height := lPaperView.PaperHeight;
lBitMap.PixelFormat:=TPixelFormat.pfDevice;
lPaperView.PaintTo(lBitMap.Canvas,0,0);
lJPG.Assign(lBitMap);
if lNextbtn.Enabled then
AList.AddObject(ASheetName+'(1)',lJPG)
else
AList.AddObject(ASheetName,lJPG);
while lNextbtn.Enabled do
begin
I := I + 1;
lNextbtn.OnClick(lNextbtn);
FForm.ShowModal;
lJPG := TJPEGIMage.Create;
lPaperView.PaintTo(lBitMap.Canvas,0,0);
lJPG.Assign(lBitMap);
AList.AddObject(ASheetName+'('+sysUtils.IntToStr(I)+')',lJPG);
end;
finally
lBitMap.Free;
end;
end; |
|