I use RTF as the default format. Is there a way to keep Word 2013 from showing “[Compatibility Mode]” after the title of every document? It is taking up lots of space in the taskbar and title bar and makes the titles of documents hard to read.
There's no way to suppress using a setting - RTF file format hasn't been the "plain text" version of a Word document since Word 2007, when the Word Open XML format took over that role. Any RTF file equates to Compatibillity Mode since it cannot support the newer Word functionality.
The only possibility you'd have would be to set the Caption property of the Application object, using VBA or another language automating the Word application. But you need to be aware that this is not permanent in any way.
Related
I have a Word-Document with some links to cells in Excel-files. In Word, I can get a context menu, that leads to a window with all the links of the document. There, I can see and manipulate properties of the links.
Amongst others, there is the part "Updatemethod for chosen link" (words may differ, I translated it from the German version), I have two radio-boxes with "automatic" / "manual". And a Checkbox "locked".
I want to modify (especially the locked-checkbox) these properties with OpenXML, but I did not find the place, where in the model this information is stored. I printed the OuterXML for a link with locked checked and for a link with locked unchecked, but did not find any differences in the parameter field (\a \f 5 \h * MERGEFORMAT - for both!)
Anyone knows, how I can modify this with OpenXML SDK?
Thanks in advance,
Frank
Word has different ways to represent the LINK in Office Open XML depending partly on the format of the link (e.g. whether you Paste Link to an object or to plain text).
For example, if you paste a link to a "Microsoft Excel Worksheet Object", although Word displays a LINK field in the document, the XML does not actually record the field code using either the simple or more complex encoding for field codes. It actually encodes the object in a <w:object> element that records information about a "shape", with the shape type in <v:shapetype>, the shape itself in <v:shape>, and information about the OLE link in <o:OLEObject>
In that case, Automatic link updating is recorded using
<o:OLEObject UpdateMode='Always'> for automatic links
and
<o:OLEObject UpdateMode='OnCall'> for manual links.
Whether or not the link is Locked is recorded in
<o:OLEObject><o:LockedField></o:LockedField<o:OLEObject>
(either as "false" or "" AFAICS).
Word reconstructs the LINK field code from the w:object information when it displays the document.
However, if you paste the link as text, the XML Word records will contain a complex field code construction, starting with a <w:fldChar w:fldCharType='begin' /> element.
In that case, the fact that the link is locked is indicated by a value of '1" in the w:fldLock attribute, and probably the absence of that attribute if it is not locked. e.g.
<w:fldChar w:fldCharType='begin' w:fldLock='1' />
In either case, an automatic link is indicated by the presence of the \a switch in the field code (reconstructed in the case of the first example). If there is no \a switch, it's not an automatic link.
That may not cover all the possible cases but should give you some clues about where to look in the XML.
A simple html page has FORMATTED text - not fancy - line breaks, and italic.
I want to have a button that takes this formatted text, and copies it to the clipboard, formatted (it is planned to be pasted into some LibreOffice document later).
Couldn't find how to do it.
I tried ZeroClipboard, and a suggestion to parse the text, replacing ""-s to "\r\n". That indeed does the trick for line breaks, but what about italic?... Any means to get this functionality?...
When you create an italic tag the responsible for formatting the document and showing the text properly is the browser. If you want to copy the text you should get the text already parse and render by the browser or parse yourself the text like you did with break lines. For italics when you find a ... tag you must create the adequate text. That is, text in italics, but that depends on the language you are using, but i'm sure it can be done.
OK,
Turns out that ZeroClipboard had this functionality (of rendering the HTML text upon paste), but have disabled it.
However, the version that supports it can be found at: https://github.com/botcheddevil/ZeroClipboard
Note:
You may find that in this version, creating the client, binding the flash to a component, and handling the events are rather different than the documentation of current version of ZeroClipboard (https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md
I want to, using the DocX library [https://docx.codeplex.com/], convert a .docx document to use a different font. Does anybody know how to do that? The samples projects are very spare, and the documentation is nonexistent.
I find, too, that often there are extraneous spaces in documents, and I want to iterate over all these until there are never two contiguous spaces. I can do this in a loop, I guess, replacing " " (2 spaces) with " " (1 space) until " " (2 spaces) is no longer found.
However, I also want to remove superfluous line breaks that sometimes occur when copying-and-pasting text into a document. I can do it "manually" (in Libre Office, not sure how it's done in MS Word), as I got an answer to this question:
(select "Regular Expressions" and then replace "$" (without the quotes) with a space)
...but how programmatically, with DocX?
Additionally, in some cases I want to ADD line breaks/"paragraph returns" where there are legitimate line breaks between the end of one paragraph and the start of another, but no extra line to separate them visually. According to this:
...I can add a paragraph/line break to a legitimate line break by searching for "$" and replacing that with "\n\n"
This does work, too (manually, in Libre Office); but again...how to do this with the DocX library?
It appears that not all of this is possible with the current version of the DocX library you are using. If it is not exposed in documentation, the functions might as well not exist, and you should not be using undocumented features.
There is a much more mature library available, however, called the "Open XML SDK", that can do everything you need.
The correct way to change a font, regardless of whether you are doing it with the document editor, or you are writing a program to manipulate these files, is to change the appropriate text's style attribute, or changing the definition of style in use.
You should never, ever, ever, ever directly change the font of any text. Personally, I think that the 'font type' and 'font size' menus should be removed entirely from word/libreoffice/etc, and only be accessible inside a 'change style properties' dialog; the only reason to directly apply a font is if you are actually providing an example of particular typeface under discussion!
See How to: Replace the styles parts in a word processing document (Open XML SDK) from the MSDN documentation for a description of the way that works.
To search and replace text, the applicable MSDN page is How to: Search and replace text in a document part (Open XML SDK). For specifically replacing multiple spaces with a single space, there are numerous results on Google that should all work to at least some degree.
I have a database memo field stored as rich text format ( rtf). I can drop it in a report and set the format of the field as rtf within crystal reports version 11.5.10 and see the text without the rtf control characters. However, I want to construct a crystal reports formula/function to process the ascii text, so is there a way to programmatically within crystal report to strip the rtf control characters from the memo field so I can work with only the ascii characters ?
I could not find such a function within CR or mention of a solution to this problem by googling.
Cheers,
You could try looking at this.
http://tech.groups.yahoo.com/group/BillQuick/message/937?
I found it and used it to change/override RTF font settings to print large text for easier reading. It could probably be modified to strip to ASCII.
Cheers,
I have a column of RTF data that looks like the following:
The terms or definitions to be used in this document are:
Daily Operator. Used when the user is.......etc..
Using crystal reports I would like to grab just the BOLD text using a formula or equivalent.
I keep getting the RTF markup instead of standard text. Here is an example that I used to grab first 10 characters.
DIM convertedText as String
convertedText = cstr({table.DefinitionRTF})
FORMULA = MID(convertedText, 1, 10).
Looking ahead a bit more, how would one determine where the bold or italic Starts. Can you check for crBOLD and return the characters index position?
Thanking all in advance.
No, Crystal does not have the built-in commands to parse RTF objects by font properties. The purpose of Crystal Reports is to present formatted reports (and it more or less does this job very well). Sorry, but it's definitely not made to be a RTF parser.
I recommend doing this with some other tool, for example, a VBA script in MS Access that imports the RTF and parses it using the MS Word API. Probably wouldn't be that difficult.