Free Support Forum - aspose.com

Spurious characters in HTML

Hi,

I have the following text in the template:

'
"
''
""
'
"

I render this template using Aspose.Words and then while saving it I save it as HTML I get the following output:

‘

“

‘’

“�

‘

“

Looks like ' and "" are creating the problem. Any idea how to get over this problem?

Regards,

-rfc!

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please provide me your code.

Best regards.

Hi,

Following is the code:

final String wordLocation = TEMPLATE_FOLDER + PATH_SEPERATOR + templateName + ".doc";

com.aspose.words.License license = new com.aspose.words.License();

try {

String path = TEMPLATE_FOLDER + PATH_SEPERATOR + "Aspose.Total.Java.lic";

license.setLicense(path);

} catch (Exception e1) {

e1.printStackTrace();

}

Document doc = new Document(wordLocation);

ByteArrayOutputStream buffer = new ByteArrayOutputStream();

doc.save(buffer, SaveFormat.HTML);

String rawData = buffer.toString();

System.out.println(rawData);

I have attached the template file and the output of System.out.println(rawData); for your reference.

Regards,

rfc!

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for more information. Please try specifying charset. Please see the following code:

Document doc = new Document("Template.doc");

ByteArrayOutputStream buffer = new ByteArrayOutputStream();

doc.save(buffer, SaveFormat.HTML);

String rawData = buffer.toString("utf-8");

System.out.println(rawData);

Hope this helps.

Best regards.

Thanks Alexey ... it worked fine!

-rfc!