 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Wayne Herbert Guest
|
Posted: Fri Jan 30, 2004 11:55 pm Post subject: Stumped With Styles |
|
|
My original problem was that this statement:
Word.Selection.Style :=
Word.ActiveDocument.Styles.Item('FirstThree');
Style is not a by reference property
Avatar explained the need for interfaces/components in order to solve
the referencing problem, and I've got most of the program converted to
work with early binding.
Naturally, the style problem as come up to bite me again! Within the
interface definitions, there is no defintion for style to be found in
selection, range, paragraph, paragraphformat.
So, I'm back to the original question... how can I change the style
for the first few characters in a line, then change back to normal
styles?
Thanks.
|
|
| Back to top |
|
 |
Avatar Zondertau Guest
|
Posted: Sun Feb 01, 2004 10:00 am Post subject: Re: Stumped With Styles |
|
|
| Quote: | Word.Selection.Style :=
Word.ActiveDocument.Styles.Item('FirstThree');
Naturally, the style problem as come up to bite me again! Within the
interface definitions, there is no defintion for style to be found in
selection, range, paragraph, paragraphformat.
|
You are right, the property is not there in the interfaces. This is probably
another bug, either from Borland or from Microsoft, but the Get_Style and
Set_Style methods are there in the unit Delphi generated for me.
|
|
| Back to top |
|
 |
Wayne Herbert Guest
|
Posted: Tue Feb 03, 2004 7:51 pm Post subject: Problems With Styles, Early Binding = Was: Stumped With Styl |
|
|
Once again, thanks to Avatar's help, I've made progress. I added in a new
property to the 'Selection' interface in the Word97.pas interface definitions,
and I was able to overcome the style problem. By converting to a early binding,
I've managed to create a program in which I can set the styles. I do have one
problem and that is the following statement returns an error with an 'invalid
value'. Indeed, the passed variable is integer, so I'm not sure just what the
problem is.
Word.ActiveDocument.PageSetup.MirrorMargins := integer(true);
The bigger problem however, is that I had intended to use styles as a means of
capturing the first three characters of the first word on the page, and the
first three characters of the last word on the page. To that end, I used this
code:
OleVar := WideString('FirstThree');
OleVar2 := Word.ActiveDocument.Styles.Item(OleVar);
Word.Selection.Style := OleVar2;
first3 := Copy(tmpstr,1,3);
Word.Selection.TypeText(WideString(first3));
OleVar := WideString('Normal');
OleVar2 := Word.ActiveDocument.Styles.Item(OleVar);
Word.Selection.Style := OleVar2;
tmpstr := Copy(tmpstr,4,99);
Word.Selection.TypeText(WideString(tmpstr));
Word.Selection.TypeParagraph;
By adding a style to each line, I let Word worry about end of page.
Unfortunately, by doing it this way, I got an error message from Word 2000 after
only 3 pages - "Document formatting too complex". Sheesh!! I've got 180 pages
to format.
So, it's back to the drawing board... I guess I'll check for a page number
change, and attempt to use some sort of a user defined field.
PS: For those of you that emailed my about code... give me a couple more days
to clean up the experimental mess I have, and I'll get it out to you.
Avatar Zondertau wrote:
| Quote: | Word.Selection.Style :=
Word.ActiveDocument.Styles.Item('FirstThree');
Naturally, the style problem as come up to bite me again! Within the
interface definitions, there is no defintion for style to be found in
selection, range, paragraph, paragraphformat.
You are right, the property is not there in the interfaces. This is probably
another bug, either from Borland or from Microsoft, but the Get_Style and
Set_Style methods are there in the unit Delphi generated for me.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|