BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Table in a word document.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Magnus Holmberg
Guest





PostPosted: Tue Nov 11, 2003 11:11 am    Post subject: Table in a word document. Reply with quote



I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I want is
to have the format of the table defined in a Document (I like to use a
document as an template).

Is there any way to Read out what kind of format one table has from a word
document (size of columns, if the lines are visible and so on) and then use
ConvertToTable to create another table that looks the same as the one
defined in the Word document. If so, how?


Back to top
Michael Cessna
Guest





PostPosted: Tue Nov 11, 2003 4:08 pm    Post subject: Re: Table in a word document. Reply with quote



Here what you can do:

1. Open the document that has the table formatting you prefer.
2. Place your cursor in that table.
3. Select Tools>Macro>Record New Macro.
4. Click OK.
5. Select Table>AutoFormat.
6. Click Apply.
7. Stop recording the macro.
8. Take a look at the code that was generated.
9. Translate the code to Delphi and apply it to your new tables.

Note: You can still use ConvertToTable and then apply the formatting
afterwards.

Regards,

Michael Cessna

"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote

Quote:
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I want
is
to have the format of the table defined in a Document (I like to use a
document as an template).

Is there any way to Read out what kind of format one table has from a
word
document (size of columns, if the lines are visible and so on) and then
use
ConvertToTable to create another table that looks the same as the one
defined in the Word document. If so, how?





Back to top
Magnus
Guest





PostPosted: Tue Nov 11, 2003 10:19 pm    Post subject: Re: Table in a word document. Reply with quote



The thing is that this is manual. I like to Do it by code. I like to have a
dot file that users can be able to change and still want the program to be
able to understand the type of the table from the dot file.


"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote

Quote:
Here what you can do:

1. Open the document that has the table formatting you prefer.
2. Place your cursor in that table.
3. Select Tools>Macro>Record New Macro.
4. Click OK.
5. Select Table>AutoFormat.
6. Click Apply.
7. Stop recording the macro.
8. Take a look at the code that was generated.
9. Translate the code to Delphi and apply it to your new tables.

Note: You can still use ConvertToTable and then apply the formatting
afterwards.

Regards,

Michael Cessna

"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb0c3cf$1 (AT) newsgroups (DOT) borland.com...
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I want
is
to have the format of the table defined in a Document (I like to use a
document as an template).

Is there any way to Read out what kind of format one table has from a
word
document (size of columns, if the lines are visible and so on) and then
use
ConvertToTable to create another table that looks the same as the one
defined in the Word document. If so, how?







Back to top
Ignacio Vazquez
Guest





PostPosted: Tue Nov 11, 2003 10:36 pm    Post subject: Re: Table in a word document. Reply with quote

"Magnus" <pucko (AT) linux (DOT) nu> wrote in message
3fb16075$1 (AT) newsgroups (DOT) borland.com...
Quote:
The thing is that this is manual. I like to Do it by code.

And if you look at the code that's generated after you've done it manually
you'll probably have a better understanding of how to do it.

Cheers,
Ignacio



Back to top
Magnus Holmberg
Guest





PostPosted: Wed Nov 12, 2003 9:22 am    Post subject: Re: Table in a word document. Reply with quote

What I understand is how to create a table that looks like that table in the
document (From this code generated by the macro). But that's not the major
problem. The problem is how to get This information in Runtime. (in the
code) so I can do this automaticly. I mean I can't give the user the Source
Code and an delphi installation and say if you want another format of the
table. Generate a macro and then modify the lines 1432 to 1454 in the
source code and rebuild the application.

So my Question is more like, is there any way to read out the AutoFormat
type for an existing table?

As far as I can see the AuotFormat is an procedure to set AutoFormat for a
table. Not to read the settings.




"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
"Magnus" <pucko (AT) linux (DOT) nu> wrote in message
3fb16075$1 (AT) newsgroups (DOT) borland.com...
The thing is that this is manual. I like to Do it by code.

And if you look at the code that's generated after you've done it manually
you'll probably have a better understanding of how to do it.

Cheers,
Ignacio





Back to top
Michael Cessna
Guest





PostPosted: Wed Nov 12, 2003 11:08 pm    Post subject: Re: Table in a word document. Reply with quote

As long as you can get the Table object in code...you can read the
formatting properties from the table.

Mike

"Magnus" <pucko (AT) linux (DOT) nu> wrote

Quote:
The thing is that this is manual. I like to Do it by code. I like to have
a
dot file that users can be able to change and still want the program to be
able to understand the type of the table from the dot file.


"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote in message
news:3fb10991$1 (AT) newsgroups (DOT) borland.com...
Here what you can do:

1. Open the document that has the table formatting you prefer.
2. Place your cursor in that table.
3. Select Tools>Macro>Record New Macro.
4. Click OK.
5. Select Table>AutoFormat.
6. Click Apply.
7. Stop recording the macro.
8. Take a look at the code that was generated.
9. Translate the code to Delphi and apply it to your new tables.

Note: You can still use ConvertToTable and then apply the formatting
afterwards.

Regards,

Michael Cessna

"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb0c3cf$1 (AT) newsgroups (DOT) borland.com...
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I
want
is
to have the format of the table defined in a Document (I like to use a
document as an template).

Is there any way to Read out what kind of format one table has from a
word
document (size of columns, if the lines are visible and so on) and
then
use
ConvertToTable to create another table that looks the same as the one
defined in the Word document. If so, how?









Back to top
Magnus Holmberg
Guest





PostPosted: Thu Nov 13, 2003 9:28 am    Post subject: Re: Table in a word document. Reply with quote

It's probably me that are to stupid.

Can you give me an example and you will "Make my day".

For example, how can I read the table format.. (to se for example if it's
wdTableFormatSimple1)

Thanks.

BR

Magnus.

"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote

Quote:
As long as you can get the Table object in code...you can read the
formatting properties from the table.

Mike

"Magnus" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb16075$1 (AT) newsgroups (DOT) borland.com...
The thing is that this is manual. I like to Do it by code. I like to
have
a
dot file that users can be able to change and still want the program to
be
able to understand the type of the table from the dot file.


"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote in
message
news:3fb10991$1 (AT) newsgroups (DOT) borland.com...
Here what you can do:

1. Open the document that has the table formatting you prefer.
2. Place your cursor in that table.
3. Select Tools>Macro>Record New Macro.
4. Click OK.
5. Select Table>AutoFormat.
6. Click Apply.
7. Stop recording the macro.
8. Take a look at the code that was generated.
9. Translate the code to Delphi and apply it to your new tables.

Note: You can still use ConvertToTable and then apply the formatting
afterwards.

Regards,

Michael Cessna

"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb0c3cf$1 (AT) newsgroups (DOT) borland.com...
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I
want
is
to have the format of the table defined in a Document (I like to use
a
document as an template).

Is there any way to Read out what kind of format one table has from
a
word
document (size of columns, if the lines are visible and so on) and
then
use
ConvertToTable to create another table that looks the same as the
one
defined in the Word document. If so, how?











Back to top
Michael Cessna
Guest





PostPosted: Thu Nov 13, 2003 7:18 pm    Post subject: Re: Table in a word document. Reply with quote

I would recommend that you read the Microsoft Word Visual Basic Reference
(VBAWD10.CHM for Word XP).

Here's an example from this reference:

If ActiveDocument.Tables.Count >= 1 Then
If ActiveDocument.Tables(1).AutoFormatType <= wdTableFormatSimple3 Then
ActiveDocument.Tables(1).AutoFormat _
Format:=wdTableFormatClassic1
End If
End If

Regards,

Michael Cessna

"Magnus Holmberg"
Quote:
It's probably me that are to stupid.

Can you give me an example and you will "Make my day".

For example, how can I read the table format.. (to se for example if it's
wdTableFormatSimple1)

Thanks.

BR

Magnus.

"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote in message
news:3fb2bd80$1 (AT) newsgroups (DOT) borland.com...
As long as you can get the Table object in code...you can read the
formatting properties from the table.

Mike

"Magnus" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb16075$1 (AT) newsgroups (DOT) borland.com...
The thing is that this is manual. I like to Do it by code. I like to
have
a
dot file that users can be able to change and still want the program
to
be
able to understand the type of the table from the dot file.


"Michael Cessna" <MichaelRobertCessna@no%spam.Yahoo.com> wrote in
message
news:3fb10991$1 (AT) newsgroups (DOT) borland.com...
Here what you can do:

1. Open the document that has the table formatting you prefer.
2. Place your cursor in that table.
3. Select Tools>Macro>Record New Macro.
4. Click OK.
5. Select Table>AutoFormat.
6. Click Apply.
7. Stop recording the macro.
8. Take a look at the code that was generated.
9. Translate the code to Delphi and apply it to your new tables.

Note: You can still use ConvertToTable and then apply the formatting

afterwards.

Regards,

Michael Cessna

"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote in message
news:3fb0c3cf$1 (AT) newsgroups (DOT) borland.com...
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what
I
want
is
to have the format of the table defined in a Document (I like to
use
a
document as an template).

Is there any way to Read out what kind of format one table has
from
a
word
document (size of columns, if the lines are visible and so on) and
then
use
ConvertToTable to create another table that looks the same as the
one
defined in the Word document. If so, how?













Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Fri Nov 14, 2003 12:33 am    Post subject: Re: Table in a word document. Reply with quote

< For example, how can I read the table format.. (to se for example if
it's wdTableFormatSimple1)
Quote:


var
Tbl: Table;
...
Tbl := Doc.Tables.Item(1);
ShowMessage(IntToStr(Tbl.AutoFormatType));

Unfortunately the AutoFormatType property doesn't tell you everything,
there's an article about how to find more details here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnovba00/html/TableStyles.asp

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Francis Dion
Guest





PostPosted: Sat Nov 15, 2003 6:40 am    Post subject: Re: Table in a word document. Reply with quote

If I understand correctly, you want your application to create a Word
document with a table in it. The data would come from your application
but you would like the formating of the table to be editable by your
end-users, directly from MS-Word.

If this is indeed what you are trying to achieve, then XpertDoc is the
tool you need. It is a report generator that creates Word documents
based on Word templates. You users can easily adapt the formatting of
your report without doing any programming. All they have to do is open
the template and edit it.

You can check it out at www.xpertdoc.com



"Magnus Holmberg" <pucko (AT) linux (DOT) nu> wrote

Quote:
I have one problem:

I have a word document where I like fill a dynamic table.
The easiest and fastest way is to use the ConvertToTalbe but what I want is
to have the format of the table defined in a Document (I like to use a
document as an template).

Is there any way to Read out what kind of format one table has from a word
document (size of columns, if the lines are visible and so on) and then use
ConvertToTable to create another table that looks the same as the one
defined in the Word document. If so, how?

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.