Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jed
 
Posts: n/a
Default how to get a table

When I want to get the table in the word ,I used codes like this:

oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

But I only can get the content which in the table ,it means "table lost".
How can I get what I want?
Thanks a lot !
  #2   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default how to get a table

You can't put a table into a string.

Not really sure what you are wanting to do, but the following will take a
table from one document and put it into another:

Dim Source As Document, Target As Document, mytable As Table
Set Source = ActiveDocument
Set Target = Documents.Add
Set mytable = Source.Tables(1)
mytable.Range.Copy
Target.Range.Paste


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
When I want to get the table in the word ,I used codes like this:

oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

But I only can get the content which in the table ,it means "table lost".
How can I get what I want?
Thanks a lot !



  #3   Report Post  
Jed
 
Posts: n/a
Default how to get a table

At first,thank you for your answer.
What I want to do is : open the source document and print it,but if the
source document has tables ,when I click "open" to open it ,what I saw is
"table lost",can you tell me what can I do to get I want?

€œDoug Robbins - Word MVP€ç¼–写:

You can't put a table into a string.

Not really sure what you are wanting to do, but the following will take a
table from one document and put it into another:

Dim Source As Document, Target As Document, mytable As Table
Set Source = ActiveDocument
Set Target = Documents.Add
Set mytable = Source.Tables(1)
mytable.Range.Copy
Target.Range.Paste


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
When I want to get the table in the word ,I used codes like this:

oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

But I only can get the content which in the table ,it means "table lost".
How can I get what I want?
Thanks a lot !




  #4   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default how to get a table

I gather that you are not opening the document with Word. If you want to
print the contents of the document including the table, you will have to use
Word to do it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
At first,thank you for your answer.
What I want to do is : open the source document and print it,but if the
source document has tables ,when I click "open" to open it ,what I saw is
"table lost",can you tell me what can I do to get I want?

"Doug Robbins - Word MVP"??:

You can't put a table into a string.

Not really sure what you are wanting to do, but the following will take a
table from one document and put it into another:

Dim Source As Document, Target As Document, mytable As Table
Set Source = ActiveDocument
Set Target = Documents.Add
Set mytable = Source.Tables(1)
mytable.Range.Copy
Target.Range.Paste


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
When I want to get the table in the word ,I used codes like this:

oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

But I only can get the content which in the table ,it means "table
lost".
How can I get what I want?
Thanks a lot !






  #5   Report Post  
Jed
 
Posts: n/a
Default how to get a table

HI,thanks for your attention.
Maybe I have not given the clearly depiction.
I means that:
I have an source document and I have an button named "create formal
file"(CFF),
and another button named"view formal file"(VFF).
What I want to do is :After I give the file's route and click button(CFF),
the source document will save to the specify route,and when I click the button
(VFF),the saved document will opened by myself component.
Now,the question is :if the source document's contents including the
table,when
I click the button(VFF),the document opened by myself component will lost the
table.
Following codes are in my button(CFF):
oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

Now,could you tell me ,how can I do to get I want?I don't want to copy the
table between two documents.
Perhaps you know what I said.
Thank you again!

€œDoug Robbins - Word MVP€ç¼–写:

I gather that you are not opening the document with Word. If you want to
print the contents of the document including the table, you will have to use
Word to do it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
At first,thank you for your answer.
What I want to do is : open the source document and print it,but if the
source document has tables ,when I click "open" to open it ,what I saw is
"table lost",can you tell me what can I do to get I want?

"Doug Robbins - Word MVP"??:

You can't put a table into a string.

Not really sure what you are wanting to do, but the following will take a
table from one document and put it into another:

Dim Source As Document, Target As Document, mytable As Table
Set Source = ActiveDocument
Set Target = Documents.Add
Set mytable = Source.Tables(1)
mytable.Range.Copy
Target.Range.Paste


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jed" wrote in message
...
When I want to get the table in the word ,I used codes like this:

oWordApplic = new Word.ApplicationClass();
oDoc=new Word.Document();
string strContent = "";
Open(strFilePath);
object x="3";
oDoc.ConvertNumbersToText (ref x);
strContent = oDoc.Content .Text ;
return strContent;

But I only can get the content which in the table ,it means "table
lost".
How can I get what I want?
Thanks a lot !






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table headers/footers and layout Keith Page Layout 1 April 8th 05 07:37 PM
How to Avoid Word 2003 Table Style Problems Judy Haynes Tables 0 March 23rd 05 06:41 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 07:18 PM
Row height problem with table in table Stephanie T. Tables 0 November 23rd 04 03:35 PM
table caption numbering scottkinsey Tables 1 November 11th 04 11:47 AM


All times are GMT +1. The time now is 05:12 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"