 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Rimvydas Paulavicius Guest
|
Posted: Thu Jan 27, 2005 7:26 am Post subject: StringGrid to MS Word |
|
|
Hi,
I need to export a string grid to MS Word document. I know, it's quite
easy to print the string grid to printer - just calculate colum widths
and use printer's canvas. Any ideas how to use Word "canvas"?
Rimvydas
|
|
| Back to top |
|
 |
Rimvydas Paulavicius Guest
|
Posted: Sun Jan 30, 2005 10:42 am Post subject: Re: StringGrid to MS Word |
|
|
Thank You for answer, but I did know how to export StringGrid to Word's table.
What I do not know is how to print StringGrid onto Word's "canvas" using
commands like
rt := Rect( 0, 0, column_width, colum_height );
OffsetRect( rt, left_margin, yPos );
TextRect( rt, x, yPos, Cells[c,r] );
P.S. Currently I am using fixed fonts and constructing a string from cell
values with appropriate number of spaces inserted, and then doing
MsWord.Selection.TypeText( [string] +#13+#10 );
Rimvydas
Chris Cheney wrote:
| Quote: | I need to export a string grid to MS Word document. I know, it's quite
easy to print the string grid to printer - just calculate colum widths
and use printer's canvas. Any ideas how to use Word "canvas"?
Assuming that the stringgrid cell values are to appear in a Word table:
The processing of a Word table is sloooooooooooooow, so it is best to avoid
it until the last step. I assume that the stringgrid cells will never
contain the tab character, so that it can be used unambiguously as a
separator.
Place a bookmark where the table is to appear. For each row in the
stringgrid, construct a string consisting of the contents of the cells,
separated by a tab character (#09). Use the Word TypeText and TypeParagraph
methods to insert the string as a word paragraph. Extend the bookmark over
the inserted material and then use the Word ConvertBookmarkToTable method.
There are other ways, but that is the method, based on Deborah Pate's
excellent pages on Automation (see
[url]http://www.djpate.freeserve.co.uk/AutoWord.htm)[/url], that I've used
successfully.
HTH
|
|
|
| Back to top |
|
 |
George Birbilis Guest
|
Posted: Mon Jan 31, 2005 5:49 pm Post subject: Re: StringGrid to MS Word |
|
|
Word does the rendering of the document based on the document model
(content), so you won't be able to do such things most probably
only thing Word might be giving you is some event just after each document
render and some graphics context (or interface) for you to use to draw
graphics on the offscreen buffer
Why do you need to do such thing?
| Quote: | Thank You for answer, but I did know how to export StringGrid to Word's
table.
What I do not know is how to print StringGrid onto Word's "canvas" using
commands like
rt := Rect( 0, 0, column_width, colum_height );
OffsetRect( rt, left_margin, yPos );
TextRect( rt, x, yPos, Cells[c,r] );
P.S. Currently I am using fixed fonts and constructing a string from cell
values with appropriate number of spaces inserted, and then doing
MsWord.Selection.TypeText( [string] +#13+#10 );
Rimvydas
Chris Cheney wrote:
I need to export a string grid to MS Word document. I know, it's quite
easy to print the string grid to printer - just calculate colum widths
and use printer's canvas. Any ideas how to use Word "canvas"?
Assuming that the stringgrid cell values are to appear in a Word table:
The processing of a Word table is sloooooooooooooow, so it is best to
avoid
it until the last step. I assume that the stringgrid cells will never
contain the tab character, so that it can be used unambiguously as a
separator.
Place a bookmark where the table is to appear. For each row in the
stringgrid, construct a string consisting of the contents of the cells,
separated by a tab character (#09). Use the Word TypeText and
TypeParagraph
methods to insert the string as a word paragraph. Extend the bookmark
over
the inserted material and then use the Word ConvertBookmarkToTable
method.
There are other ways, but that is the method, based on Deborah Pate's
excellent pages on Automation (see
[url]http://www.djpate.freeserve.co.uk/AutoWord.htm)[/url], that I've used
successfully.
HTH
|
|
|
| Back to top |
|
 |
Rimvydas Paulavicius Guest
|
Posted: Tue Feb 01, 2005 4:34 pm Post subject: Re: StringGrid to MS Word |
|
|
Using a Print Preview component I see the String grid and could it print nicely
on printer. What I need is to have the same look in MS Word!
Rimvydas
George Birbilis wrote:
| Quote: | Word does the rendering of the document based on the document model
(content), so you won't be able to do such things most probably
only thing Word might be giving you is some event just after each document
render and some graphics context (or interface) for you to use to draw
graphics on the offscreen buffer
Why do you need to do such thing?
Thank You for answer, but I did know how to export StringGrid to Word's
table.
What I do not know is how to print StringGrid onto Word's "canvas" using
commands like
rt := Rect( 0, 0, column_width, colum_height );
OffsetRect( rt, left_margin, yPos );
TextRect( rt, x, yPos, Cells[c,r] );
P.S. Currently I am using fixed fonts and constructing a string from cell
values with appropriate number of spaces inserted, and then doing
MsWord.Selection.TypeText( [string] +#13+#10 );
Rimvydas
Chris Cheney wrote:
I need to export a string grid to MS Word document. I know, it's quite
easy to print the string grid to printer - just calculate colum widths
and use printer's canvas. Any ideas how to use Word "canvas"?
Assuming that the stringgrid cell values are to appear in a Word table:
The processing of a Word table is sloooooooooooooow, so it is best to
avoid
it until the last step. I assume that the stringgrid cells will never
contain the tab character, so that it can be used unambiguously as a
separator.
Place a bookmark where the table is to appear. For each row in the
stringgrid, construct a string consisting of the contents of the cells,
separated by a tab character (#09). Use the Word TypeText and
TypeParagraph
methods to insert the string as a word paragraph. Extend the bookmark
over
the inserted material and then use the Word ConvertBookmarkToTable
method.
There are other ways, but that is the method, based on Deborah Pate's
excellent pages on Automation (see
[url]http://www.djpate.freeserve.co.uk/AutoWord.htm)[/url], that I've used
successfully.
HTH
|
|
|
| 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
|
|