ms-word

How to reset page number to 1 in python-docx?

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 06:42:11
问题 I've added a Field 'Page' to my code using code: def _add_field(run, field): """ add a field to a run """ fldChar1 = OxmlElement('w:fldChar') # creates a new element fldChar1.set(qn('w:fldCharType'), 'begin') # sets attribute on element instrText = OxmlElement('w:instrText') instrText.set(qn('xml:space'), 'preserve') # sets attribute on element instrText.text = field fldChar2 = OxmlElement('w:fldChar') fldChar2.set(qn('w:fldCharType'), 'separate') t = OxmlElement('w:t') t.text = "Right-click

Word Fill VBA in MS Access for various fields in table

前提是你 提交于 2021-01-28 05:10:16
问题 For our incident management side of our database I am trying to have data from fields in my table(s) generate within the 149 Investigative Report, a Word document template provided by the state (see link here). I made a read-only version of the document to preserve its integrity by forcing a save as by the user and loaded it with text form fields with bookmarks to reference (example: txtcaseintroduction ). I modified code I found in the internet for working with form fields and assigned it to

Exception reading manifest from file. Microsoft Word Add-in VSTO

亡梦爱人 提交于 2021-01-28 03:31:09
问题 I am trying to create a Microsoft Word add-in that will add and commit to a git repo every time the Word document is saved, either auto save or manual save. I have been able to get the functionality I desire when I run the program from within Visual Studio (debug mode). When I publish and install the add-in so that it runs when Word starts, I get the following error. Now when I try to add the LibGit2Sharp NuGet packages, running in debug mode from within Visual Studio gives me this error: and

Problem adding image in the header of word document

大兔子大兔子 提交于 2021-01-28 02:06:57
问题 I'm adding a picture in the header of a word document. It shows a frame for the image and says "the image cannot currently be display". If I add text to the header it show the text, and if I add the image in the document body, it also shows the image. So is getting the image and it show text on the header, but no the image. I'm running out of checkings, can anyone advise with this please? Thank you! public static void createHeaderAndFotter(XWPFDocument document) throws IOException,

Add row to word doc using C# [duplicate]

纵然是瞬间 提交于 2021-01-27 22:00:47
问题 This question already has answers here : Add a row to an MS Word table using Office.Interop (2 answers) Closed 2 years ago . I created a table in word document using c#, I am trying to add row to the end of the table. for now I have table with 4 rows. I tried to add like this: int rowIndex=1; this.Tables[1].Rows.Add(this.Tables[1].Rows[rowIndex]); Source. if I set int rowIndex=1; it adds row to the begining of the table, when I tried to set it to int rowIndex=4; it adds row to the row before

C# Word Interop - Open a .pdf without the conversion prompt

痞子三分冷 提交于 2021-01-27 20:59:30
问题 I am using the Word Interop and wish to open a .pdf file and let word automatically do the conversion. I have the following properties set. var wordApp = new Word.Application(); wordApp.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone; wordApp.Options.DoNotPromptForConvert = true; wordApp.Options.ConfirmConversions = false; var doc = wordApp.Documents.OpenNoRepairDialog(ExternalFilePath, false, true); However when it does the Open I still get the following prompt: Word version 2016. Does anyone

Check for Numeric Value in Word Macro using Regular Expressions

…衆ロ難τιáo~ 提交于 2021-01-27 20:58:18
问题 Is it possible to directly use regular expressions in Word macros? I want to check if a string contains only numbers and the following code does not work. isNumber = RegEx.IsMatch("234", "[0-9]+$") I simply need it to return true or false. 回答1: You can create an instance of the VBScript.Regexp object within your code, but an easier solution would be to use the existing VBA function IsNumeric . Both methods are included below: Sub testNumeric() 'Use IsNumeric MsgBox (IsNumeric("12345"))

Word Addin/OfficeJS - Detect if Cursor is on Chart Element

泄露秘密 提交于 2021-01-27 19:50:31
问题 I want to be able to check if the document cursor is inside of a Chart element within the MS Word API. Right now I have an application that inserts text, but when I try to insert said text into the title of the Chart, it deletes the chart and replaces it with the Content Control I'm inserting. Instead of deleting the chart, I want to check if the cursor is inside of the Chart via context. If I'm inside of the Chart in any way, be able to throw a warning message to the user and escape. Is

VBA from Word to Excel

霸气de小男生 提交于 2021-01-27 19:38:24
问题 I'm having issues with some VBA code that lives in a Word Template. The intent is to have the code open an Excel book, reference to Sheet named "Log", and find a row based on the Word document's name. Once the name is matched, I want to change a cells value to "completed". Then save and close the Excel workbook. I have tried the code below which will open the correct work book, but wont update the cell to "Completed", I get an error: Private Sub CommandButton1_Click() '***********************

VBA from Word to Excel

做~自己de王妃 提交于 2021-01-27 19:20:31
问题 I'm having issues with some VBA code that lives in a Word Template. The intent is to have the code open an Excel book, reference to Sheet named "Log", and find a row based on the Word document's name. Once the name is matched, I want to change a cells value to "completed". Then save and close the Excel workbook. I have tried the code below which will open the correct work book, but wont update the cell to "Completed", I get an error: Private Sub CommandButton1_Click() '***********************