word-2007

MS Word Plugin, Adding a button which pops up on right click on selected text

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:48:32
I am working on a shared addin for MS Word 2007. I would like to add a button which pops up when selected text is right clicked. The attached snapshot should make this clear. Currently, the user has to select the text and then click a button on a custom control. It would be a lot easier if after selecting the text, s/he could right click it and press the relevant button in the popup. You need to extend the correct contextmenu. The following link describes in words (no source code) how this can be achieved: Shared Addin using Word Maybe this Link might help a little with the coding. I haven't

How do you change the content of a content control in Word 2007 with OpenXml SDK 2.0?

跟風遠走 提交于 2019-12-03 03:21:42
About to go mad with this problem. I'm sure it's so simple I'm just missing it, but I cannot for the life of me find out how to change the content of a content control in Word 2007 with the OpenXml SDK v2.0 in C#. I have created a Word document with a plain text content control. The tag for this control is "FirstName". In code, I'd like to open up the Word document, find this content control, and change the content without losing the formatting. The solution I finally got to work involved finding the content control, inserting a run after it, then removing the content control as such: using

Update embedded excel file programmatically

久未见 提交于 2019-12-01 20:09:52
I'm trying to modify an embedded excel table in a word document programmatically. To do this, I have modified the docx file and the embedded excel file. The significant part of the main document is the following: <w:object w:dxaOrig="8406" w:dyaOrig="2056"> <v:shape id="_x0000_i1028" type="#_x0000_t75" style="width:390.75pt;height:95.25pt" o:ole=""><v:imagedata r:id="rId14" o:title=""/> </v:shape> <o:OLEObject Type="Embed" ProgID="Excel.Sheet.12" ShapeID="_x0000_i1028" DrawAspect="Content" ObjectID="_1349794876" r:id="rId15" UpdateMode="Always"/> </w:object> The word document uses an OLEObject

How can I create a header in a table for each new page with Word interop?

本秂侑毒 提交于 2019-12-01 09:02:35
I am trying to create a table with a header. I want this header to be repeated for each new page that the table takes. How can I do this in C# with Word 2007 Interop? Microsoft.Office.Interop.Word.Table table; /* ... */ table.Rows[1].HeadingFormat = -1; This is what word for me, Looping through each table at the end foreach (Table item in doc.Tables) { item.Rows[1].HeadingFormat = -1; item.ApplyStyleHeadingRows = true; } and setting a style on each table with the property set to create a header on each new t.set_Style(TableStyle); 来源: https://stackoverflow.com/questions/1816957/how-can-i

Is it possible to add some data to a Word document?

喜你入骨 提交于 2019-11-28 00:33:44
Is it possible to add (thru the MS Word object model? or by editing file) some custom data (another file maybe?) Will be that data preserved after opening, changing and saving document in MS Word ? (I need to put some tracking data in docx during some report export, custom data will be used again during import) Yes. It's rather straightforward, but as far as I know, not documented (at all or very well). Say you want to add an .ini file to your your Office doc (.docx, .xslx, .pptx) to be "carried around" with your document (i.e. you send your .docx to someone over email and want the yourfile