Page 1 of 1

Override Smart Copy-Paste of XHTML document

Posted: Wed Feb 05, 2014 3:41 pm
by micogonzales
Hi. I'd like to know how I can override the default copy-paste from word on an XHTML document.
For example, when I copy a bold text from word, it is inserted like this

Code: Select all

<b>This is a text.</b>
But I want to change it so that when it's pasted, in the text mode it's:

Code: Select all

<span class="font_weight_bold">This is a text.</span>
Please help me find a solution for this.
Thanks.

Re: Override Smart Copy-Paste of XHTML document

Posted: Wed Feb 05, 2014 4:28 pm
by sorin_ristache
Hello,

The default Paste action in Author mode in the Oxygen application inserts in the current XHTML document exactly the content exported by the Copy action executed in the Word application. If you are in Text mode you get only the text content on paste, but in Author mode you get the XHTML content exported by the Word application. Please make sure that the type of your Oxygen document is XHTML, not other type of XML document, and that you execute the Paste action in Author mode.

Why do you think that Word exported

Code: Select all

<span class="font_weight_bold">This is a text.</span>
but in Author mode in the Oxygen application you get the following?

Code: Select all

<b>This is a text.</b>
Can you send us a small sample Word document for testing your case?


Regards,
Sorin

Re: Override Smart Copy-Paste of XHTML document

Posted: Thu Feb 06, 2014 6:45 am
by micogonzales
What I mean is that I have this text in Word:

Code: Select all

Hi this is a text.
I copied and pasted it on the Author mode of Oxygen. I go to Text mode to see the tags and I see this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<p class="MsoNormal"><b>Hi this is a text.</b></p>
</body>
</html>
So you see the tags inserted are <b>
but I want it to configure Oxygen so that what I see upon pasting is something like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<span class="font_weight_bold">Hi this is a text.</span>
</body>
</html>
My question is how do I do that.

Re: Override Smart Copy-Paste of XHTML document

Posted: Thu Feb 06, 2014 11:35 am
by sorin_ristache
You can modify the XHTML content exported by the Excel application by editing the following XSLT stylesheet:

Code: Select all

[Oxygen-install-dir]\frameworks\xhtml\resources\xhtml2xhtml.xsl
For example you can add an XSLT template in this file that processes the element:

Code: Select all

<p class="MsoNormal"><b>Hi this is a text.</b></p>
and transforms it to an element:

Code: Select all

<span class="font_weight_bold">Hi this is a text.</span>

Regards,
Sorin