Is there a way to show all docvariables from a word file? - ms-word

I have a Microsoft-Word File which contains several DocVariables.
In our application we fill/replace these DocVariables with content.
With the shortcut Alt+F9 I can switch in a mode in which I can see the DocVariable.
But in the document I have now, there are DocVariable which I cannot see.
Is there a way/mode in Word 2007 in which I can see all the DocVariables which are defined in the Word-File?

As far as I know there is not a way to do this with MS Word's built in features. You could write a custom VBA script that would get a list of all the DocVariables. But even easier than that I use the following program when I need to do what you are saying: http://gregmaxey.mvps.org/word_tip_pages/cc_var_bm_doc_prop_tools_addin.html
It is a free add-in for Word that has done the job very well the times I used it.

Related

The auto numbering/bullets of the Source MS Word document do not automatically align with those of the Destination MS Word document

It happens when a user inserts a Word Document(Source) into another Word Document(Destination) - auto numbering/bullets didn't work...
I wont to insert text here, and continue auto-numbering of source as it in destination:
Step 1
But it inserting above without auto-numbering:
Step 2
I have an answer from MS that it's a feature of MS Word :(.
So, the question is - is it possible to automatically align the above either by use Word Automation ( via C# , .NET Interop Word APIs )?
I mean to align the source document contents as per the destination document’s Auto-numbering. The same is about Bullets...
Please help - we are open to any suggestions/ recommendations.
Both documents need to have the same style definitions for both the Paragraph Style of the text being copied and also the List Style that organizes the numbering or bullets. Using automation, you can copy styles between the files before actually moving the numbered or bulleted text.
I agree with John.
The basic idea is to use the Define New MultiLevel List Dialog to define a new multilevel list in which each level you would be using is attached to an existing paragraph style. A paragraph style can be attached to only one level in one list. Then use the styles to apply the numbering.
Once you have them set up, you apply the numbering by using the styles, not the numbering controls.
Setting up the numbering linked to styles can seem a bit convoluted. Step-by-step instructions for doing it in Windows can be found here:
http://www.shaunakelly.com/word/numbering/numbering20072010.html
Backup: http://web.archive.org/web/20130510174814/http://www.shaunakelly.com/word/numbering/numbering20072010.html
For a Mac, John has a page showing the Mac controls to accomplish it.
http://www.brandwares.com/bestpractices/2016/06/outline-numbering-in-word-for-os-x/
Backup link: http://web.archive.org/web/20200912134758/http://www.brandwares.com/bestpractices/2016/06/outline-numbering-in-word-for-os-x/
These describe the only known ways to have consistent numbering in Word in heavily-edited / co-authored documents.

Word 2010 additional file format

I'm not sure whether this is the best approach for this or whether I perhaps should ask the question more clearer.
What I want to do is to create an additional file output - e.g. if the user uses Word to create a description consisting of known tags, I want to be able to save this as bbcode.
Now I do have an idea of how to do this, but is there a way to say add another file format to the "Save file"-dialog box and have it run a parser and file writer, that'd read the current document and export it using known bbcode-tags (that perhaps would be adjustable from some configuration window)?
The result would be a file containing bbcode as well as the text information that the user has entered.
How would I hook up my addin to the file output dialog? Is there a way to do this? I'm not sure it's custom XML since I won't be using the XML at all.
Thanks in advance and please excuse my poor English.
Edit: after having a look at the Word 2010 AddIn-project, I figured, that I'm looking for a way to define my own "export"-format. I'd like to export the BBCode to a .txt (or even .bbcode) file. The Microsoft.Office.Interop.Word.WdExportFormat seems to have its own fixed enumeration. Is there a way to add an export-format?
There is some code for this here:
phpbb.com/community/viewtopic.php?f=17&t=395554

How to create reports containing text and figures with MATLAB

I am using a MATLAB script to tune the control system on a machine. When the tuning is complete, I would like a report containing text (especially serial number, date/time and the values determined during tuning) and plots, especially transfer functions.
What do to you recommend?
Whatever solution I use should be compatible with the MATLAB compiler so I can distribute my solution to a team of field engineers.
Ideally the report will be a PDF document.
The MATLAB report generator does not seem to be the right product as it appears that I have to break up my script into little pieces and embed them in the report template. My script contains opportunities for the user to intervene and change values or reject the tune if plots don't look right and my hunch is that this will be difficult if the code runs from the report generator. Also, I fear code structure and maintainability will be lost if the code structure is determined by the requirements of the report template.
Please comment if my assumptions are wrong.
UPDATE
I have now switched to use the MATLAB Report Generator with release r2016b and it is working very well for my compiled code users. Unfortunately it means that colleagues who have a MATLAB licence need to buy the Report Generator too, to use my tools scripted.
As the MATLAB Report Generator's development manager, I am concerned that this question may leave the wrong impression about the Report Generator's capabilities.
For one thing, the Report Generator does not require you to break a script up into little pieces and run them inside a template. You can do this if you choose and in some circumstances, it makes sense, but it is not a requirement. In fact, many Report Generator applications use a MATLAB script or program to interact with a user, generate data in the MATLAB workspace, and as a final step, generate a report from the workspace data.
Moreover, as of the R2014b version, the MATLAB Report Generator comes with a document generation API, called the DOM API, that allows you to embed document generation statements in a MATLAB program. For example, you can programmatically create a document object, add and format text, paragraphs, tables, images, lists, and subdocuments, and output Microsoft Word, HTML, or PDF output, depending on the output type you select. You can even programmatically fill in the blanks in forms that you create, using Word or an HTML editor.
The API runs on Windows, Linux, and Mac platforms and generates Word and HTML output on all three, without the use of Word. On Windows, it uses Word under the hood to produce PDF output from the Word documents that it generates.
The latest release of the MATLAB Report Generator introduces a PowerPoint API with capabilities similar to the DOM API. If you need to include report generation in your MATLAB application, please don't rule out the MATLAB Report Generator based on past impressions. You may be surprised at just how powerful it has become.
I've done this quite a bit. You're right that MATLAB Report Generator is typically not a great solution. #Max suggests the right approach (automating Word through its COM interface), but I'd add a few extra comments and tips, based on my experiences.
Remember that if you're going with this solution, you are depending that your end-users will be running Windows, and have a copy of Office on their machine. If you want to ultimately produce a PDF report, that will need to be Office 2010 or above.
I would bet that you'll find it easier to automate the report generation in Excel rather than Word. Given that you're producing a report from MATLAB, you'll likely be wanting quite a lot of things in tables of numbers, which are easier to lay out in Excel.
If you are going to do it in Word, the easiest way is to first (without MATLAB) create a template .doc/.docx file, which contains any generic text that will be the same for all reports and blank tables for any information. Turn on track changes, and insert empty comments at each point that you will be filling in information. Then within your report creation routine in MATLAB, connect to Word and iterate through each comment, replacing it with whatever data you wish.
If you are learning to automate Excel from MATLAB, this page from the Excel Interop documentation is really helpful. There's an equivalent one for Word.
Unlike #Max, I've never had good results by saving figures to an .emf file and then inserting them. In theory that does preserve editability, but I've never found that valuable. Instead, get the figure looking right (and the right size) in MATLAB, then copy it to the clipboard with print(figHandle, 'dbitmap') and paste to Excel with Worksheet.Range('A1').PasteSpecial.
To save as a PDF, use Workbook.ExportAsFixedFormat('xlTypePDF', pathToOutputFile).
Hope that helps!
I think you are right about the report generator.
In my opinion the fastest/easiest approach would be to generate the report in a html document. For that you just need the figures and write a text file, conversion should be trivial.
Quite similar approach would be to create a Latex file. And then create a pdf from it - though for this you'd need to install latex on your deployed machines.
Lastly you could use the good integration of Java in Matlab. There are several libraries you could use - like this. But I wonder if all the complication will be worth it.
Have you considered driving Microsoft Word through its ActiveX interface? I've done this in compiled Matlab programs and it works well. Look at the Matlab help for actxserver(): The object you want to create is of type Word.Application.
Edit to add: To get figures into the document, save them as .emf files using the -dmeta argument to print(), then add them to the document like this:
WordServer.Selection.InlineShapes.AddPicture(fileName);

Script for parsing winword doc document

MS Office Word document has the following structure:
Title(line, font size 14)
Description(paragraph, font size 12)
Some other paragraphs of text(font size 12)
I need script to extract Titles and Descriptions from this document(and, for example, to put them into Excel table). ANy ideas about such script?
Well, you may need to clarify the question a little more. But as far as script goes,
1) Use VBA (It's part of Word), you could easily write a little VBA macro that would load up a doc, parse that info, write it to a CSV file and close the doc, then repeat for the next doc.
2) VBScript (basically same as above but use VBScript as the language, similiar but not exactly the same as VBA).
3) JavaScript (same idea as VBScript above).
4) Powershell (a .net way to do the same thing).
Personally, if this is a one off deal, I'd go with VBA and be done with it.

How to save a document in ms word 2003 using command prompt?

Please help, How to save a document in ms word 2003 using command prompt?
The only thing I know about cmd is making a directory(mkdir), open ms word(win word), and hide rar files to jpeg files. And moving files from 1 directory to another.
You can open Word document from the command prompt (starting a new Word process), but there is no easy way of sending any commands to a runnning instance of Word by a simple command line script. If you want to save Word documents programmatically, you can, for example, use VBA ("macros") or VBScript for it. But it would make much more sense if you change the Word document programmatically before, so I suggest that you first make yourself comfortable with VBA.
AFAIK there's no direct way to send a command from command line to words UI. You have to imploy a tool or trick here:
Using an autostart macro was sufficient if you want to convert data like opening a txt or html file with the command line and save it as a doc file with the autostart macro. It may even work to shut word down again within that autostart macro.
Another possibility is a kind of Win-GUI-recorder like AutoIT. This can create scripts or exes containing a script that record some actions you have previously shown it yourself (and much much more). Take a look at their pages at http://www.autoitscript.com/autoit3/.
And a third possibility is Word's ActiveX-IF that can be acessed by any programming system (even AutoIT).
Greetings from Germany!
LuI