index > Visual Studio Tools for Office > Insert contents of a byte[] or stream object into current word do...

Insert contents of a byte[] or stream object into current word do...


Hi,

I am currently working with VSTO for Word and SharePoint 2007.

I have extended the Actions pane to provide me with functionality to browse a SharePoint document library.

Once the user selects the document from the Actions Pane (displayed in a List Box), I want to insert the contents of that document in the current document at the current cursor position.

So far I have been able to read the document from Sharepoint document library in a Stream object.

Where I am struggling is in inserting the contents of the stream object in the current document.

Can anyone lead me in the right direction as to how to insert contents of a document to the current document?

I have seen examples of inserting plain text in the document, but that does not help me as I have a byte[]/stream object to work with.

Any help would be highly appreciated.

Thanks

-Pritam Dahake

Pritam Dahake

Hi Pritam

The Word object model doesn't support "streaming" content in or out. Assuming the document on Sharepoint has been saved in the native Word 2007 XML file format you should be able to use the InsertXML method to put the information into the open Word document.




-- Cindy Meister (Word MVP)
Cindy Meister

Cindy,

Thanks a lot for your response. The document is indeed saved on the SharePoint site as docx.

My problem is that being a newbie to the XML word format, I need some pointers as to how I can read the text from the document using XML.

I know I need to use the System.IO.Package class for doing it...but beyond that I am still trying to figure out what to do.

Any help would be highly appreciated.

Thanks

-Pritam

Pritam Dahake

If you're automating Word, then use the XML property of the RANGE object.

If you're picking up the document "as is" (without automation) then you need to read the documentation on the MSDN site about the new Open Office file formats. I suggest starting with Brian Jones' blog.

http://blogs.msdn.com/brian_jones/archive/2006/09/29/777423.aspx




-- Cindy Meister (Word MVP)
Cindy Meister
reply 4

You can use google to search for other answers

 

More Articles

Deployment issues of VSTO
Passing excel workbook object
Any changes in the shim program?
How to use ApplyCustomType?
Disappearing Document ActionTask Panes with Word
Export Data to Excel
Assembly Reference Error
Displaying an icon on a commandbarbutton object
Add VSTORuntime and PIA to the bootstrapper packages directory
[SOS] Why I can't create a new sheet via this code snippet???
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Death at the first hurdle.. cannot even …
Installing an outlook Addin on another m…
Help to surpress group subtotal in excel…
Adobe not playing nice with VSTO
Assembly * cound not be found
VSTO and SolutionCodeGroupName [Was: In …
Microsoft Access Charting Question
VSTO deployment ??light solution.
Global Address list - microsoft outlook
How detect if PIAs Installed?
Please try this: view Word doc in webBro…
C++ Excel Automation using Excel add-in …
VSTO Outlook Calendar
Action Pane Holder Customization
Excel File Deployed to WSS?

Hot Articles

Excel/Streamwriter/Kludgy NamedRange acc…
What versions of Office 12 will support …
The customization does not have the requ…
Error loading the requested managed obje…
VSTO Outlook 2007 Questions
Shared Add-in - Excel Add-in for Office …
Something Missing with Intellisense due …
How to copy owc's chart to Excel?
VSTO 2003 - Office Standard vs Professio…
How can I call a managed code extensions…
Error when add control in the actionsPane
Help Needed: Smart Tags in Excel and Rec…
Can I save information inside a Word Doc…
EXCEL
excell parameters

Recommend Articles

Does VSTO solution work with Word 2002 a…
Get worksheet names from excel
COM Addin, in frame work 1.1 , C# and o…
how to add custom images to command bar …
How to empty "From" field usin…
Replacing text
Problem with VBA and Excel
Help on exporting data from C# 2005 to a…
populate docvariables
VSTO for Excel
Open Internet Explorer through a macro?
XML
PivotTable Total From Database
How to delete the user?? Command Bar?(Ou…
Word to XML from C#