in
http://officeopenxml.com/WPtableCaption.php
it is written that
<w:tblCaption w:val="caption text"/>
is the tag for table caption , but when I add it to the xml, I get error and also the caption is not shown.
When I add the caption directly from the Word it is added as :
<w:p w:rsidR="00346450" w:rsidRDefault="00346450" w:rsidP="00346450">
<w:pPr>
<w:pStyle w:val="Caption"/>
<w:keepNext/>
</w:pPr>
<w:r>
<w:t>caption text</w:t>
</w:r>
</w:p>
I use Word 2010, can someone explain this? maybe w:tblCaption isn't used anymore and it was not updated in officeopenxml.com ?
Take another look at the page you link to: the tblCaption tag is a child element of tblPr (table properties).
What this page does not tell you is that this is not a "caption" in the sense of the term Word users understand it. It's actually the "Alt-text" for a web-page, in case the Word document is saved as a web page. So it's never going to be visible in the Word document. You can see the option in the UI by selecting the table, going to the "Properties" dialog and choosing the "Alt Text" tab.
A "real" caption is the Word Open XML you show in your second code snippet. What marks it as a caption is the style applied to it. It can be positioned anywhere in the document, although Word's built-in tool to insert a caption will offer to place it above or below the object it's for.
Related
I have an Access database (Screenshot is attached) in which the text of an editor is stored line by line in the DB (called StoryLine column). I have the problem that URLs are stored as hypertext "URL" display names. Sometimes only hyperlinks are displayed in one line and the "URL" goes over several lines and then the display name is displayed.
Thank you very much for your help and hints.
I have merged all entries (with Formula) that are assigned to the same entry (all connected texts have the same StoryID). The problem is that the formatting is completely lost.
Only the display text of the URL should be displayed, if it exists, otherwise the complete URL.
HYPERLINK "http://votetandem.org" votetandem.org
should be
voteandem.org (formatted as Hyperlink)
and
HYPERLINK enter link description here
Acquista ora i
biglietti!
should be
Acquista ora i biglietti! (formatted as Hyperlink)
If I understand your question correctly, the below should work for you;
Create a Formula and type the desired text and hyperlink using the HTML tag like:
Insert the Formula Field on the report. Right click on the "Formula Field" inserted on the report, and select "Format Field"
In the "Format Editor" window, select the tab "Paragraph". For the option "Text Interpretation", select "HTML Text"
Note that the SAP Hyperlink text displayed above is the actual hyperlink and selectable by the user. In your case, it may be a matter of just doing option 3 from above on the required fields. I don't know your current structure of the report to give you an exact answer.
Concat Strings
Create a formula with something as such. I haven't tested this so it may need some tweaking.
if {Command_Main.StoryLinesK} in ['45','46','47', '48',''49] then {Command_Main.StoryLine} & "" & {Command_Main.StoryLine}
I have a java program that search rsidR="00CA303F" inside document.xml(unzipped of DOCX).
<w:sdtContent>
<w:r w:rsidR="00CA303F">
<w:rPr>
<w:rFonts w:cs="Arial"/>
<w:b/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>17-Jan-14</w:t>
</w:r>
</w:sdtContent>
The problem: if i change something like the date in the docx and after i save the file, this rsidR change! and im not able to find it next time in my program.
How i can freeze-fixed it? or which other fixed-element can i add to w:r for find it after saving file?
Solutions(not working) that i tryed: I added other tags(hoping they will not change), i tryed for example: w:rsidRDefault, w:id, w:val, w:rsidRPr to this w:r, but Word wont be able to open file docx after.
Word or the OpenXML file format do not offer a direct way to add an ID to an element, which is also persisted if the document is edited.
As a workaround, you can create a character style which you then apply to the run of text you are interested in. Then you can search for the w:rStyle element with the correct character style in the w:val attribute:
<w:r w:rsidRPr="00E05157">
<w:rPr>
<w:rStyle w:val="MyCharacterStyle"/>
</w:rPr>
<w:t>17-Jan-14</w:t>
</w:r>
It should be possible to assign a unique id to the containing w:sdt (in the descendant w:sdtPr/w:id/#w:val). See for example the docx4java documentation for sdtPr.
A good explanation of rsid's, and how they are used by MS Word, is in What's up with all those rsid's. In many application it is harmless to completely ignore them.
I am using PHPWord to ger
nerate word elements. I want to insert a bulleted list using setValue in my template.
I tried inserting this snippet
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="1"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>One</w:t>
</w:r>
</w:p>
But somehow I am missing the style. where do I need to insert the style and what style?
I worked based on that page: https://msdn.microsoft.com/de-de/library/office/ee922775%28v=office.14%29.aspx
The <w:pStyle> element takes the style ID as its w:val attribute. So in this case, the 'List Paragraph' style. List Paragraph does not have a bullet. If you want a bullet you'll need to use List Bullet instead.
Note that this will only actually work if the style in question is explicitly defined in the /word/styles.xml part. The List Bullet style is a so-called 'built-in' style, and is not written by Word into the styles.xml part until it is used for the first time.
So it's possible you may need to add it yourself. The Word behavior when a paragraph is assigned an undefined style is simply to use the default paragraph style, probably Normal.
I'm trying to create something whereby I can enter text once and then display that text back in other places in my document. What I'm hoping is that if I edit the first instance of the text, the other references of it would update as well.
You can do that with Word "content control databinding"; put both references in a bound content control pointing to the same XML element.
Using the Open XML SDK I've been successful in programatically finding bookmarks or text strings in a word document and inserting new content. I'm using OpenXmlPowerTools.SearchAndReplacer to do the text search and replace and this post's answer for the bookmarks Replace bookmark text in Word file using Open XML SDK
This all fails when the bookmark or the text I am trying to replace is located inside a Textbox.
Why does neither approach work within a Textbox? The Word documents I am trying to replace content within use Texboxes for layout and I can't work out what the problem is.
Does anybody have suggestions as to what might be the problem? Thanks
I did this - it works on text boxes in the case where there are not multiple runs with text (like 1 word bolded
Dim searchQuery = From tx In mainPart.Document.Body.Descendants(Of Text)()
Where tx.Text.Contains(replaceData.OldText)
Dim i As Integer
For i = 0 To searchQuery.Count - 1
searchQuery(i).Text = searchQuery(i).Text.Replace(replaceData.OldText, replaceData.NewText)
Next
Here is the XML for a simple textbox with the word test in it:
<w:pict xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
<v:stroke joinstyle="miter" />
<v:path gradientshapeok="t" o:connecttype="rect" />
</v:shapetype>
<v:shape id="_x0000_s1027" style="position:absolute;margin-left:0;margin-top:0;width:186.35pt;height:110.6pt;z-index:251660288;mso-width-percent:400;mso-height-percent:200;mso-position-horizontal:center;mso-width-percent:400;mso-height-percent:200;mso-width-relative:margin;mso-height-relative:margin" type="#_x0000_t202" xmlns:v="urn:schemas-microsoft-com:vml">
<v:textbox style="mso-fit-shape-to-text:t">
<w:txbxContent>
<w:p w:rsidR="00B558B5" w:rsidRDefault="00B558B5">
<w:proofErr w:type="gramStart" />
<w:r>
<w:t>test</w:t>
</w:r>
<w:proofErr w:type="gramEnd" />
</w:p>
</w:txbxContent>
</v:textbox>
</v:shape>
</w:pict>
You can see the structure is different then when searching for text within a bookmark since a textbox is actually stored as a picture. If you adjust your searching algorithm to deal with this different structure then you should be able to find the text and replace it.