My client have a requirement to add particular style to bullet numbers and character in all levels.
Till now i tried to get NumberingDefinitionsPart from MainDocumentPart and trying to find out any style id for my paragraph.
Unfortunately i am not able to crack it this way since i am getting NumberingDefinitionsPart as null.
my list is
This
Is
The inner Xml looks like
<w:pPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:pStyle w:val="ListParagraph" />
<w:numPr><w:ilvl w:val="0" />
<w:numId w:val="3" />
</w:numPr><w:spacing w:before="80" w:line="220" w:lineRule="exact" />
</w:pPr>
<w:r xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:t>This</w:t>
</w:r>
<w:pPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:pStyle w:val="ListParagraph" />
<w:numPr>
<w:ilvl w:val="0" />
<w:numId w:val="3" />
</w:numPr>
<w:spacing w:before="80" w:line="220" w:lineRule="exact" />
</w:pPr>
<w:r xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:t>Is</w:t>
</w:r>
Is there anything i am missing in my document?
Can i archive it any other way?
Thanks in advance.
Related
I am developing a Word addin with Office-js. I want to create a button in my ribbon. This button's name and tooltip should be AAA & BBB.
So, I developed the following part of the xml manifest.
<Group id="XXX.GrpYYY">
<Label resid="XXX.GrpYYY.Label"/>
<Icon>...</Icon>
<Control xsi:type="Button" id="XXX.BtnYYY">
<Label resid="XXX.BtnYYY.Label" />
<Supertip>
<Title resid="XXX.BtnYYY.Label" />
<Description resid="XXX.BtnYYY.Tooltip" />
</Supertip>
<Icon>...</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="XXX.YYY.SL" />
</Action>
</Control>
</Group>
And this is the relevant part of the Resources in the xml manifest:
<bt:ShortStrings>
...
<bt:String id="XXX.GrpYYY.Label" DefaultValue="MY GROUP" />
...
<bt:String id="XXX.BtnYYY.Label" DefaultValue="AAA & BBB" />
...
</bt:ShortStrings>
<bt:LongStrings>
...
<bt:String id="XXX.BtnYYY.Tooltip" DefaultValue="AAA & BBB" />
...
</bt:LongStrings>
This is the result:
As you can see the & symbol in the tooltip is doubled.
Is it a bug or am I doing something wrong? Is there a way to avoid doubling this symbol?
I am creating a word document report where a website hyperlink will be generated using below code.
Here I am using w:tgtFrame='_blank' but no use that it still gets opened in the same browser.
Please let me know for the solution.
<w:document>
<w:p w:rsidR='00CA103F' w:rsidRDefault='00CA103F' w:rsidP='00264350'>
<w:r>
<w:t>Website: </w:t>
</w:r>
<w:hyperlink r:id='rId100' w:history='1' w:tgtFrame='_blank'>
<w:r w:rsidRPr='00CA103F'>
<w:rPr>
<w:rStyle w:val='Hyperlink' />
<w:rFonts w:cs='Arial' />
<w:u w:val='single' />
</w:rPr>
<w:t>" + Website + "</w:t>
</w:r>
</w:hyperlink>
</w:p>
</w:document>"
I got this from another forum:
http://answers.microsoft.com/en-us/office/forum/office_2010-word/hyperlinks-in-msword-2010-target-frame-issue/e65c6ee2-6b3c-475f-8d01-1f5b49f91a09
It looks like Adobe issue that the URL will display in the same window and now solution yet from Adobe.
Is it possible to programmatically hide parts of an OpenXML document, without actually removing it?
The reason I would want to do this: This is a template file, dynamic parts are filled using databindig. And some parts should be hidden, if there is no backing data. But don't want to actually remove parts from the document, so the document could be "refreshed" later with new data.
Something like display: none in html/css.
The is no exact equivalent to hiding content in Word using the open xml sdk. However there are two approaches that might work for you:
Hidden paragraph trick
Create a style, let's call it HiddenParagraph. Define it in your styles.xml as follows:
<w:style w:type="paragraph" w:customStyle="1" w:styleId="HiddenParagraph">
<w:name w:val="HiddenParagraph" />
<w:next w:val="Normal" />
<w:pPr>
<w:spacing w:line="14" w:lineRule="auto" />
</w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorEastAsia" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:style>
The w:line=14 makes the paragraph effectively invisible.
Now render the content your don't want to see using this paragraph style.
<w:p>
<w:pPr>
<w:pStyle w:val="HiddenParagraph" />
</w:pPr>
<w:r>
<w:text>you should not be able to see me
</w:r>
</w:p>
To show the content again just change the paragraph style to normal or some other more sane style.
Custom XML Part
Store data you don't want to display in the document in a custom xml data store, although this might not work in your specific scenario
Reference
http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2010/10/27/59361.aspx
How can I show label on the top of the line in the bar2d graphic?
For example:
|-------------------------
| This is line!
|================= 70%
|
| This is line 2!
|====== 30%
|-------------------------
Thanks.
Natively, FusionCharts does not support this feature. However, what makes FusionCharts really amazing is the number of workaround or tweaks you can come up with to address an issue (makes my job easier too :)
Please try out the following XML snippet using a Single series Bar 2D chart.
<?xml version="1.0" encoding="UTF-8"?>
<chart caption="Monthly Unit Sales" xAxisName="Month" yAxisName="Units" showValues="1" decimals="0" formatNumberScale="0" chartRightMargin="30">
<set label="" value="0" alpha="0.1" displayValue="
Feb" />
<set label="" value="857" />
<set label="" value="0" alpha="0.1" displayValue="
Apr" />
<set label="" value="494" />
</chart>
What we have done here is used empty and invisible data-plot above the data-plots we want to showcase with the Label on top. Thereby, using the displayValue attribute in the invisible data-plot, we can recreate the visual effect of the Labels being on-top of the data-plot being displayed.
Note: The character (new line break) has been used to bring the output of the displayValue attribute, i.e. the apparent Label in this case, closer to the data-plot below.
Alternatively, you may also use the Multi-series Bar 2D chart to re-create the above mentioned effect, using the XML snippet quoted below.
<?xml version="1.0" encoding="UTF-8"?>
<chart palette="2" caption="Business Results: 2005" yaxisname="Revenue (Millions)" hovercapbg="FFFFFF" toolTipBorder="889E6D" divLineColor="999999" divLineAlpha="80" showShadow="0" canvasBgColor="FEFEFE" canvasBaseColor="FEFEFE" canvasBaseAlpha="50" divLineIsDashed="1" divLineDashLen="1" divLineDashGap="2" numberPrefix="$" numberSuffix="M" chartRightMargin="30" useRoundEdges="1" legendBorderAlpha="0">
<categories>
<category label="" />
<category label="" />
<category label="" />
</categories>
<dataset seriesname="Domestic" color="8EAC41">
<set value="0" alpha="0.1" displayValue="Hardware" />
<set value="0" alpha="0.1" displayValue="Software" />
<set value="0" alpha="0.1" displayValue="Service" />
</dataset>
<dataset seriesname="International" color="607142">
<set value="116" />
<set value="237" />
<set value="83" />
</dataset>
</chart>
I hope this helps. :D
Do you know what basic information MUST include a paragraph (<w:p/>) in document.xml inside a *.docx document, that specifies an image? I do know there must be:
<a:blip r:embed="rId4" />
specifing the relationship id, but what else?
It's very hard to find it in Google and experimenting with cutting out tags from a ready document or reading the specification takes a lot of time.
An example with all the required tags would be greatly appreciated.
Word is rather picky concerning the input XML provided. To embed an image, you have to provide quite some information. Here is a simple example:
document.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5943600" cy="3717290"/>
<wp:docPr id="1" name="Picture 0" descr="vlcsnap-325726.png"/>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="myImage.png"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId4"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5943600" cy="3717290"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
</w:body>
</w:document>
document.xml.rels
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<!-- other relationships go here -->
<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png"/>
</Relationships>
And of course the image must be added to the package at the correct location (media/image1.png)
Since all this is rather complicated I would recommend you to use the OpenXML SDK 2.0 provided by Microsoft or another library, e.g. OpenXML4J. These libraries, especially the one from Microsoft can make your work a lot easier.