How can I Map from XML HREF+Text to Word Document Hyperlink? - vba

I Have a simple XML file e.g.:
<root>
<some_link_href>http://www.microsoft.com/</some_link_href>
<some_link_text>goto microsoft site</some_link_text>
</root>
I have setup XmlMapping, but I can't seem to get a Hyperlink.
I tried using richTextControl and and providing RTF text
(e.g. '{\rtf1\pc some \b BOLD \b0 text}') but it just shown the raw RTF.
Note: even though I'd like to have a Text with HREF, I can settle for clickable URI
Is there any other control? other good methods to use?
also posted # https://learn.microsoft.com/en-us/answers/questions/720964/place-link-on-winword-from-xmlmapping.html

Related

How to validate xml:lang ATTLIST inside XML with DTD?

Many articles on the internet (like this one) suggest using xml:lang or some custom attribute to encode meta-information about language inside XML tags. They mention that these codes have to comply with BCP47 standard.
Let's see what would happen if I encode language attribute as articles suggest:
Inside DTD: <!ATTLIST text xml:lang NMTOKEN #IMPLIED>
Inside XML: <text xml:lang="YODU991Yklew-e-ijsw02ijwk">...</text>
What is the expected result?
DTD validator would check if YODU991Yklew-e-ijsw02ijwk code is a real BCP47 language code, if country and script exist and mark it red, if those codes that are incorrect. Exactly the same way as http://schneegans.de/ helps validating these codes (WRONG code vs. CORRECT code).
What happens instead?
Validator percieves this attribute only as some text and does not validate, if it as a real language code or some gibberish.

How do I add HTML tags and links in QnA-maker?

I have tried the suggestions provided for other similar questions but they didn't work.
here 2 example:
1) Link: name of your link is changed by QnAMaker during the save and train step in name of your link](https://url.com)) and it is diplayed in the test feature
name of your link](https://url.com))
2) <b> bold text </b> is not changed in bold and the same thing happens with the escaped html
Did you consider markdown? You examples are supported.
Cheatsheet to help you on you way.

OfficeJS Word Addin - Modify content control in the whole document ( including header/footer )

Due to the office API limitation ( API is only restricted to rich text content controls). We had to insert content controls as an OOXML object. It inserted the content control correctly but office API doesn’t recognize that as a content control. For example, using office API, if you call a method to get all the content controls, above content control will not be returned.
If you run following code, it will not return those content controls that were inserted like that.
// Run a batch operation against the Word object model.
Word.run(function (context) {
// Create a proxy object for the content controls collection.
var contentControls = context.document.contentControls;
}
Here is the OOXML:
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" />
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml">
<w:body>
<w:sdt>
<w:sdtPr>
<w:alias w:val="[REPLACE_THIS]" />
<w:id w:val="1382295294" />
<w:placeholder>
<w:docPart w:val="4D926923E99F45DBAF2203E4FEA73047" />
</w:placeholder>
<w:dataBinding w:xpath="[REPLACE_THIS]" w:storeItemID="{AFE97E21-6B3F-435F-8566-BD38F346ABE4}" />
<w:showingPlcHdr />
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r>
<w:t>[REPLACE_THIS]</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
</w:body>
</w:document>
</pkg:xmlData>
</pkg:part>
</pkg:package>
As Office API doesn't have any built-in methods to get these content controls and modify them. I have to read each section of the document, Get the OOXML , modify it and insert it back. Is there any other way to do this ? As this is really cumbersome and error-prone process.
I am assuming that you are using OOXML to insert other types of content controls (i.e. plain text, combo, date, etc.) and if that's the case, yes, in the content control collection we do not support, as of now, other types of content controls other than rich text. This is mostly because of a limitation in Word Online who only supports rich text as of today, and we ship APIs that can guarantee a multiplatform behavior. The plan is that when it eventually supports other types they will be included as part of the collection (hence the type property).
so, yes for now your only way out is to get the OOXML and handle the other types of control via XML. You can probably target the OOXML you get if you wrap them with a rich text content control and only getting the OOXML of the wrapper content controls.

How to use special characters on pentaho Dashboard

I'm trying to use special characters on my dashboard using a HTML structure.
It only works if I use HTML Entities such as "& atilde;" (without space) for ã.
But is it the only way to do it? Is there anywhere I can set UTF-8, for example?
I tried to put a META tag setting UTF-8, but I didn't work.
Here's what I'm doying:
Input:
Output:
I need to type: "Alocação de Funcionários"
Notice that I also set a custom noDataMessage_text on Advanced Properties > Extension points of my first Bar Char and, since the message also have special characters on it, using the HTML Entity would certainly not be a good idea.
UPDATE:
I have the same problem when I was looking for my Cubes when I was using the OLAP Selector Wizard
I think your problem will solve. You can use like these.
<h1 style="font-weight: bold;"> Alocação de Funcionários<h1>
or
<h1 style="color:#297385l"> AlocaÇão de Funcionários</h1>
I got these output in my dashboard.
I am thinking your font family is creating some issue. Please copy the exact h1 tag line and paste it in your dashboard let's see.
Thank you.

Sitecore 7 Lucene: strip HTML from computed field

I am pasting together all "paragraph" child nodes from an "article" node in a computed field. This is to achieve that an article can be searched & found by its paragraph contents.
To achieve this, I did the following, under the <fields hint="raw:AddComputedIndexField"> node:
<field fieldName="Paragraphs" storageType="YES" indexType="TOKENIZED">
MyWebsite.ComputedFields.Paragraphs,MyWebsite
</field>
In this computed field, I concat the paragraph HTML bodies together.
I was assuming Sitecore would strip the HTML for me (like it does for rich text fields), but it does noet.
For "rich text" fields, it is probably the RichTextFieldReader that strips the HTML tags out. Decompiling the code confirms this.
The RichTextFieldReader is configured in the FieldReaders section. Trying to add a raw:AddFieldReaderByFieldNamesection below, does not seem to do anything.
The full section looks as follows, but does not work in this setup:
<FieldReaders type="Sitecore.ContentSearch.FieldReaders.FieldReaderMap, Sitecore.ContentSearch">
<mapFieldByTypeName hint="raw:AddFieldReaderByFieldTypeName">
....default stuff here...
</mapFieldByTypeName>
<mapFieldByFieldName hint="raw:AddFieldReaderByFieldName">
<fieldReader fieldName="Paragraphs" fieldReaderType="Sitecore.ContentSearch.FieldReaders.RichTextFieldReader, Sitecore.ContentSearch"></fieldReader>
</mapFieldByFieldName>
</FieldReaders>
Any other clues on how to achieve this (by config, not by using HTML agility pack etc)
The problem is the mapFieldByFieldName is expecting to match a field with that name from the Sitecore item, not a custom computed field in your index so the field reader is never called.
I don't know how to achieve this from config, but if you do not want to directly use HAP but are willing to use some code then after you paste your fields together in your computed field class just do what Sitecore does in the GetPlainText() method:
string input = "concatenated string";
return HttpUtility.HtmlDecode(Regex.Replace(input, "<[^>]*>", string.Empty));
or use the util method Sitecore.StringUtil.RemoveTags(text)