Does anyone know how to modify the document autoformat feature in MS Word? - ms-word

I'm trying to automate applying a format to a document in Word. The Autoformat dialog has three options for Document Type: General Document; Letter; Email. I had thought that I could create a template based on the document type, but I can't find much documentation on this feature and a search of the Word folders doesn't turn up anything promising. Can anyone shed any light on this?
Thanks

Since this is StackOverflow (=programming) I'm going to assume you're looking for a way to access this via VBA (a macro). The AutoFormat "type" is set using the Document.Kind object, which takes a member of the WdDocumentKind Enum:
wdDocumentEmail 2 E-mail format.
wdDocumentLetter 1 Letter format.
wdDocumentNotSpecified 0 No format specified.
Recording a macro while applying AutoFormat gives code like this:
Selection.Document.Kind = wdDocumentLetter
Selection.Range.AutoFormat
It's not very clear to me why you'd want to use AutoFormat when setting up a template. Usually, when people take the trouble to use a template they also define a set of styles and a UI for people to use the styles...

Related

Inserting non-text items in VS code similar to RTF editors?

I use VS code for lots of things, from actual programming to just taking notes or conspecting. A few features I would really love would be
ability to insert images in between the text
live, cell based auto formatting for text that forms a small table
Both of these can be done in rich text editors like ms word by inserting just images or an excel table.
Now I realize that VS code is rather file format agnostic and it wouldn't make a whole lot of sense to somehow have an excel table in the middle of a .js file but I think there is a way.
For example, JSDoc is a kind of add-on format that lives entirely within js comments. Same could be done with tables and/or images. Of course there wouldn't be a universal way to encode this but just like JSDoc it could be adapted to different language environments, be it a php file or c file or plain text.
For example, in raw text format, an auto formatted table of data could look something like this within a javascript file:
const my_data = [
/*!!! auto_format_csv(Title, Description, Weight) !!!*/
"Apple", "A nice fruit", 1,
"Car", "A motorized vehicle", 2000
/*!!! auto_format_end !!!*/
];
and while editing the file in vs code, it could look something like this:
So to the question part: are there perhaps any extensions that already do this sort of thing? If not, is it possible to create such an extension with the liberties given to extensions as of right now?
I know that vs code is based on electron and open source so in theory, everything is possible but I want to have these features as easily as possible so having framework support for this would likely help a lot.

How to change rmarkdown/bookdown word_document citation and bibliography style

For an article I am writing I need to adhere to a specific bibliography/citation style (the SAGE Harvard reference style).
I have the correct bibliography file (in this case SageH.bst) and would like to set this as a style for the word_document output.
I know that this is possible for pdf documents using the biblio-style parameter. However, this does not seem to work for Word documents and I find no reference in the Rmarkdown or bookdown manuals on how and if it is even possible to specify the style.
Instead of the .bst file supplied by the publisher, I was able to set the bibliography style using pandoc_args and a csl file from the Zotero Style Repository.
For anyone wondering, the correct (simplified) options supplied to the _output.yml should have been:
bookdown::word_document2:
reference_docx: "template.docx"
pandoc_args: [
--csl=sage-harvard.csl
]

Autoformat word table in perl

I have created a word document in perl with normal text and tables.
Now i want to format my table but i can't find the way to do this.
I know to put a format on my table i need to execute following command
$table->AutoFormat(x); with x being e number from 0 to ....
But there are a lot of table styles. I want just a normal one (which is style 16) but i want to assign the border lines and vertical lines myself to create a table by my choosing. Does anyone knew the syntax for this one , or a documentation of the autoformat syntax so that i know which number is which table style
I know this is a question for documentation or tutorials but i searched a lot online and can't find any explanation about the autoformat syntax. And which numbers represet the border or the style . I hope some could help me out here.
You need to look at Microsoft's Visual Basic documentation for the
Word object model.
The OLE interface is simple to understand from there
The page for Table.AutoFormat is here

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

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

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.