asi
asked on
Word Document methods
hello,
After I open with word a basic document i wish to add one by one pictures (or document) after the base document text.
The problem is that the pictures i add are always inserting before the original text (top document), and not on the bottom of the document.
I Also want that every picture will stretch as much as possible to the word document width.
how can i fix it ? ?
Here is my code
try
WordApp := GetActiveOleObject('Word.A pplication ');
except on exception do
WordApp := CreateOleObject('Word.Appl ication');
end;
WordApp.ActiveDocument.Sha pes.AddPic ture('C:\B ackup\Firs t.tif', True,True);
WordApp.ActiveDocument.Sha pes.AddPic ture('C:\B ackup\Seco nd.tif', True,True);
i.e. the document shoud be in that order
1) Original text
2) picture #1 (how to stretch ?)
2) picture #2
etc...
Its look like the cursor is not on the right location (on the top and not on the buttom)
I use delphi 5Pro
thank u
Asi
After I open with word a basic document i wish to add one by one pictures (or document) after the base document text.
The problem is that the pictures i add are always inserting before the original text (top document), and not on the bottom of the document.
I Also want that every picture will stretch as much as possible to the word document width.
how can i fix it ? ?
Here is my code
try
WordApp := GetActiveOleObject('Word.A
except on exception do
WordApp := CreateOleObject('Word.Appl
end;
WordApp.ActiveDocument.Sha
WordApp.ActiveDocument.Sha
i.e. the document shoud be in that order
1) Original text
2) picture #1 (how to stretch ?)
2) picture #2
etc...
Its look like the cursor is not on the right location (on the top and not on the buttom)
I use delphi 5Pro
thank u
Asi
ASKER
how can i know the page Width ?
thank u
Asi
Asi,
Its not the page width, is the image width. You can load the picture you want to insert to a delphi image component (jpg and bmp unless you have a custom component to load tif images) and check the top, left, height and width of the image. Having this, you can stretch the image just changing the proper values.
best regards,
manuel Lopez (lopem)
Its not the page width, is the image width. You can load the picture you want to insert to a delphi image component (jpg and bmp unless you have a custom component to load tif images) and check the top, left, height and width of the image. Having this, you can stretch the image just changing the proper values.
best regards,
manuel Lopez (lopem)
ASKER
yes , but suppose i wish to streach the image to the page width , and i dont know the page width in advance , how can i do that ?
thank u
Asi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes , but suppose i wish to streach the image to the page width , and i dont know the page width in advance , how can i do that ?
thank u
Asi
Hi Asi,
I dont know. Sorry. I dont have the last Word reference. Probably there is a way but I dont know how to do that.
best regards,
Manuel Lopez (lopem)
I dont know. Sorry. I dont have the last Word reference. Probably there is a way but I dont know how to do that.
best regards,
Manuel Lopez (lopem)
asi:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
asi,
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: Award points to lopem http:#7154721
Please leave any comments here within 7 days.
-- Please DO NOT accept this comment as an answer ! --
Thanks,
anAKiN
EE Cleanup Volunteer
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: Award points to lopem http:#7154721
Please leave any comments here within 7 days.
-- Please DO NOT accept this comment as an answer ! --
Thanks,
anAKiN
EE Cleanup Volunteer
Your code:
WordApp.ActiveDocument.Sha
WordApp.ActiveDocument.Sha
didnt work for me. In fact, when Im typing the line you gave the system ask for these parameters:
const FileName: WideString; var LinkToFile: OleVariant; var SaveWithDocument: OleVariant;
var Left: OleVariant; Top : OleVariant; var Width: Olevariant; var Height: OleVariant; var Anchor: Olevariant
So i get an error: Types of actual and formal var parameters must be identical.
the method you used (AddPicture) can include the size of the image, Left, Top, Width and Height)
So try something like this:
MsWord.ActiveDocument.Shap
If you want first to send the cursor to the end of the document (before inserting the images), try the next procedure:
procedure EndCursor;
//send cursor to the end of the active document
var
Unidad : OleVariant;
Extended : OleVariant;
begin
Unidad := wdStory;
Extended := Unassigned;
Form1.MSWord.Selection.End
end;
Best regards
Manuel Lopez (lopem)