ms-word

OpenXML nested tables

本秂侑毒 提交于 2020-01-23 06:27:07
问题 I am trying to insert a Table into a TableCell, but when I try to open it in MS Word I get a message like: " a <p> is required before a </tc> ". When I open the file in compatibility mode the table formatting looks perfect but the table lines are missing. Inserting simple text into the cell works fine, the issue only happens when I try to insert a whole table. Inserting the Table in the document outside the other table also works fine. 回答1: If you create a nested table structure in Word, and

How do I get the current filename of a Word document, without the extension or full path, using a macro?

流过昼夜 提交于 2020-01-23 06:13:31
问题 I have code that extracts the full path of a file, minus the extension, and I'm trying to modify it to only store the name of the file, once again without the extension. Sub ShowFilename() Dim pathName As String With ActiveDocument If Len(.Path) = 0 Then .Save End If If Right(.Name, 1) = "x" Then pathName = Left$(.FullName, (Len(.FullName) - 5)) Else pathName = Left$(.FullName, (Len(.FullName) - 4)) End If End With MsgBox pathName End Sub This displays C:\Users\test , and the document's name

Run-time error '7': Out of memory

别说谁变了你拦得住时间么 提交于 2020-01-23 02:07:32
问题 I'm trying to edit embedded charts in Word documents. My source code is below. It has worked a long time but not for the last two days. I get this error: Run-time error '7': Out of memory I have searched a lot , but I don't understand the problem. When I shutdown computer and after open it, then it works correctly, but after I get error again. It gives error in this part: 'create range with Cell Set oChart = oInShapes.Chart oChart.ChartData.Activate ' ***Note: It gives error here*** 'Set

Prevent Word 2010 from saving o:gfxdata base64 or uuencoded VML?

一个人想着一个人 提交于 2020-01-23 01:37:48
问题 I am working with .docx files containing several drawing canvases with images inserted and some lines and arrows drawn in Word 2010. I am using 2010 format with no compatibility mode. Word inserts an o:gfxdata attribute into each v:shape and v:group element and fills it with ascii encoded something. From what I have read it may be a copy of the VML describing the v:shape or v:group . I don't know if I just don't know what to look for, but I cannot determine what this data is for as its

Direct download link to OneDrive file?

依然范特西╮ 提交于 2020-01-22 23:03:46
问题 A OneDrive sharable link looks like this: https://1drv.ms/w/s!AqmFiI7maXrRgT7PGcK_7JyZlBco. How do I get the direct download link version of this? I know with a onedrive.live/redir?<...> link I can just replace the 'redir' with 'download', but how do I do that for a link that looks like the one above? Thanks. 回答1: If you follow the instruction here you can generate a URL that will act on the shared item, including being able to get its content. In your case the URL would look like https://api

C# return memory stream from OpenXML resulting to a corrupted word file

和自甴很熟 提交于 2020-01-22 14:38:12
问题 I have a problem with a MemoryStream from OpenXML. I succeed with opening a Word file, changing it and downloading it through the HttpResponse if I do all the steps in a single method. But if I try to do it in two different classes (or methods) by returning the MemoryStream, I get a corrupted word file. I thought about a flushing or buffer problem but I don't find a solution. Here is the working code : public void FillTemplateOpenXmlWord(HttpResponse response) { string filePath = @"c:

How to insert shape in cursor position when user clicks

五迷三道 提交于 2020-01-22 03:57:05
问题 I am trying to insert a shape in a position of cursor where user click by an event WindowBeforeDoubleClick, but when I use the code below its relate to screen coordinate so it is not placing in word page properly. can anyone suggest how to find the page margin coordinate or any other in order to place the shape at cursor point in word. This is the code Public Sub addWin() ActiveDocument.Shapes.AddShape(msoShapeRectangle, MouseX, MouseY, 20#, _ 16#).Select Selection.ShapeRange.Name = "WK# " &

Change style of some words is very slow VBA Word

只愿长相守 提交于 2020-01-22 03:04:13
问题 I´d like to change the style of several words in all instances within active document since each word could appear more than once within document. The words are stored in array Arr() . Some words are bold and some are unbold. If the wordX found is unbold a want to replace the style to StyleA and if it is bold I want to change it to StyleB I have the following code so far that since to have 2 issues. 1-) Both, words with bold and not bold format are change to StyleA 2-) The execution time is

VBA (Word): force user form to update in real time

半世苍凉 提交于 2020-01-22 02:43:31
问题 I have a word file (Word 2016) with approx. 750 fields. Through a VBA macro I update each field separately ( .Fields(i).Update ) in order to be able to make a "poor men's" progress bar showing the user the status of the update (how many fields have been updated and how many fields there are in total): 'Select Storyrange (first section) Dim rngRange as Range rngRange = ThisDocument.StoryRanges(wdMainTextStory) Dim intFields as Integer intFields = rngRange.Fields.Count 'Show Form UserForm1.Show

VB .NET automation, Document.SaveAs corrupting Word Document

戏子无情 提交于 2020-01-22 02:26:26
问题 Just to start I try to summarize what I want to do: My vb .net app done in vs2019 simply automates and fills a word template, it should at the end save it in a folder provided by a text box saved in the variable URL. Everything is fine and dandy but if I try to open the word docx I get this: . Also if I save using the saveAs from word itself,manually, the file isn't corrupted anymore. And there is difference in size between the files that are pretty much the same: . . . SO, the file "Adresa