word-contentcontrol

How do I change a Microsoft Word Content Control placeholder text format using a VBA script?

冷暖自知 提交于 2021-01-29 14:28:56
问题 I have created a Microsoft Word Form using interactive Content Controls. It is a really long form with a variety of fields and field types (drop down lists, text boxes, combo boxes, check boxes, etc...) After a couple of months and multiple edits it came back to me with inconsistent formatting of field values and placeholder text values. Some fields stay grayed out even after you fill them out. Other fields have placeholder text that is not grayed out at all. The font seems to have

document.contentControls not returning all ContentControls in the document

不羁岁月 提交于 2021-01-29 09:21:40
问题 I have a document with three ContentControl objects that looks like this: Here is the .docx file in its entirety - but essentially the markup of the document body looks like this: <w:body> <w:p w:rsidR="0075044D" w:rsidRDefault="0075044D"> <w:r> <w:t xml:space="preserve">Video provides a powerful way to help you </w:t> </w:r> <w:sdt> <w:sdtPr> <w:alias w:val="cc1"/> <w:tag w:val="prove"/> <w:id w:val="806369342"/> <w:placeholder> <w:docPart w:val="1F3FDE3D075A4E8AADE251C4E318E379"/> </w

Is it possible to add Repeating Section Content Control section with VBA?

感情迁移 提交于 2020-01-06 06:18:12
问题 I have created Word template with Repeating Section Rontent Control (RSCC) containing other Content Controls . Also I have excel workbook with information which should go to mentioned Word template. The thing I am trying to do is to create macro which would fill Word template with information from selected rows in Excel workbook (each row to new RSCC section). I have quite good idea how to do that, except one thing- I cannot figure out how to write macro which would add another section to

Blank line after deleting contentControl in word

六眼飞鱼酱① 提交于 2019-12-20 04:56:10
问题 I'm trying to write in a word document via VB.net and for this I'm using contentControls in my Word Document but sometimes I have to delete a contentControl or another via VB code. It's kind of easy with contentcontrol.delete but when this contentControl contains multipleline and I want to delete it then it leaves a blank line. How can I avoid this? 回答1: I will give you some tips based on VBA which I hope you could easily convert to vb.net and your solution. You need to cover complete range

Word, docx4j and content control text formatting

会有一股神秘感。 提交于 2019-12-11 12:08:06
问题 I'm using docx4j to create Word documents using a Word template. The template contents control which in the document are filled with text by my Java code. The problem is that the formatting I have added to some of the controls has no effect. I have tried formatting with both text content controls and rich text content controls. In fact, the entire document appears grey (including the image in the document header) so I'm not sure that the problem is specific to docx4j. Here is my code: private

Export the content of content control into another word document

冷暖自知 提交于 2019-12-11 03:39:03
问题 I have a word document with many content controls. How can I export the content of content control into another word document? I'm using C# and open xml sdk. Regards. 回答1: Here are two great articles that will show you how to do this: Using LINQ to XML to Retrieve Content Controls in Word 2007 Using Nested Content Controls for Data and Content Extraction from Open XML WordprocessingML Documents 回答2: content controls are not bound to CustomXMLParts. I'm using Altchunck to merge multiple docx

How to get the list of all content controls in the document?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:39:37
问题 I am using interop and I want to get the list of all content controls contained in word document (in the body, shapes, header, footer..). Is this the correct and the best way to do this : public static List<ContentControl> GetAllContentControls(Document wordDocument) { if (null == wordDocument) throw new ArgumentNullException("wordDocument"); List<ContentControl> ccList = new List<ContentControl>(); ; // Body cc var inBodyCc = (from r in wordDocument.ContentControls.Cast<ContentControl>()

How to get the list of all content controls in the document?

好久不见. 提交于 2019-12-04 12:01:47
I am using interop and I want to get the list of all content controls contained in word document (in the body, shapes, header, footer..). Is this the correct and the best way to do this : public static List<ContentControl> GetAllContentControls(Document wordDocument) { if (null == wordDocument) throw new ArgumentNullException("wordDocument"); List<ContentControl> ccList = new List<ContentControl>(); ; // Body cc var inBodyCc = (from r in wordDocument.ContentControls.Cast<ContentControl>() select r); ccList.AddRange(inBodyCc); // cc within shapes foreach (Shape shape in wordDocument.Shapes) {

Replacing Content Controls in OpenXML

若如初见. 提交于 2019-12-03 05:09:58
问题 I need something as a placeholder. I at first looked to Content Control as a solution but I'm having some problems with it. I then looked into adding CustomXML to the .docx but turned away from that because of the i4i lawsuit. Then I decided I would just plain change the text of the Content Control through OpenXML SDK 2.0 but even if it's so marked the Content Control doesn't go away. I guess that it doesn't know that the text changed unless it happens inside word. I could perhaps just remove

Replacing Content Controls in OpenXML

喜欢而已 提交于 2019-12-02 18:27:13
I need something as a placeholder. I at first looked to Content Control as a solution but I'm having some problems with it. I then looked into adding CustomXML to the .docx but turned away from that because of the i4i lawsuit. Then I decided I would just plain change the text of the Content Control through OpenXML SDK 2.0 but even if it's so marked the Content Control doesn't go away. I guess that it doesn't know that the text changed unless it happens inside word. I could perhaps just remove the CC and place text instead but I'm afraid of problems with format and styles it could bring and