Home > Back-end >  How to use Delphi control to excel in the stick into the cad connection images
How to use Delphi control to excel in the stick into the cad connection images

Time:10-14

I prepared in an excel template, this template is the picture in the cad connection pictures, now to do so: made a format excel document is saved; Constructs an excel document, at a specific location with vba in construction document into the template document of a certain figure,
Who can help, what kind of instruction?

CodePudding user response:

PasteSpecial

 
Var
FExcel: Variant;
FWorkbook: Variant;
FWorksheet: Variant;
The begin
Try
FExcel:=CreateOleObject (' excel. Application);
Except,
Screen. The cursor:=crDefault;
MessageDlg (' Could not start Microsoft Excel! ', mtError, [mbCancel], 0);
The Exit;
end;

Try
FWorkBook:=FExcel WorkBooks. Add;
//FWorkSheet:=FWorkBook. WorkSheets. Add;
FWorkSheet:=FWorkBook WorkSheets [1].

//add code here to copy image to clipboard
FWorkSheet. Cells [1, 1]. PasteSpecial;//to the inside of the clipboard images pasted into the first row, first column
The finally
FExcel. Visible:=True;
end;

CodePudding user response:

That's how I do, or not, or post with borders do not conform to the requirements

CodePudding user response:

Post your code to see,,,
What is the frame is not in conformity with the requirements?

CodePudding user response:

Procedure Tgcglfrm. Pstpic (sheet_s: olevariant);//from the gallery (excel file) copy the blanking sheet here
Var
I, ys: integer;
Soup, sheet: olevariant;
The begin
Try
Ys:=0;
Soup:=exl. Workbooks. Open (GCMGFLN. Value);
Ys:=1;
The finally
If ys=1 then
The begin
Try
Ys:=0;
Sheet:=soup. Sheets [XLDFRM. BHC. Text];
Ys:=1;
The finally
If ys=1 then
The begin
Sheet. Range [' A2: f16]. Copy;
Sheet_s. Cells [2, 1]. PasteSpecial;

end;
end;
end;
end;

end;
Sheet is a template file, sheet_s is the target file

CodePudding user response:

The above code from a file of copies of the main out of the picture on the clipboard, after but the execution to paste the clipboard operation "sheet_s. Cells (2, 1] PasteSpecial;" After no response, but manual paste can be labeled, images have been copied, just paste the code is invalid

CodePudding user response:

reference 5 floor sankis204112 reply:
the code from a file of copies of the main out of the picture on the clipboard, but perform the paste the clipboard operations "sheet_s. Cells (2, 1] PasteSpecial;" After no response, but manual paste can be labeled, images have been copied, just paste the code is invalid


Is that it didn't work: sheet_s) cells (2, 1]. PasteSpecial;

You will try not to sheet_s passed as a parameter, defined as a global variable called try,

CodePudding user response:

Just tried the useless, but can according to your thoughts and see where there is a problem
  • Related