Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table headers/footers and layout | Page Layout | |||
How to Avoid Word 2003 Table Style Problems | Tables | |||
Table AutoFormats vs. Table Styles confusion | Tables | |||
Row height problem with table in table | Tables | |||
table caption numbering | Tables |