Product DocsMenu

Coveo Platform 6.5 >
Developer Help > Open Converter API > Conversion Scripts > Postconversion > Samples > Sample 4 - Change View As HTML Version of Document

Sample 4 - Change View As HTML Version of Document

Postconversion Sample #4 (JScript Version)

// ****************************************************************************
//  This postconversion script sample changes the default View As HTML version
//  of the document.
// ****************************************************************************
 
// Build a new document content stream.
var documentContent = "This is a custom document content set by a postconversion script!";

// Set the document content stream.
PostConversion.TextToOverride.WriteString(documentContent);

// Build a new View As HTML stream.
var viewAsHTML = "";
viewAsHTML += "<html><body>";
viewAsHTML += "This is a custom View As HTML stream set by a postconversion script!";
viewAsHTML += "</body></html>";

// Set the View As HTML stream.
PostConversion.HTMLOutputToOverride.WriteString(viewAsHTML);

Postconversion Sample #4 (VBScript Version)

'****************************************************************************
' This postconversion script sample changes the default View As HTML version
' of the document.
'****************************************************************************
 
Option Explicit

' Build a new document content stream.
Dim documentContent
documentContent = "This is a custom document content set by a postconversion script!"

' Set the document content stream.
PostConversion.TextToOverride.WriteString documentContent

' Build a new View As HTML stream.
Dim viewAsHTML: viewAsHTML = ""
viewAsHTML = viewAsHTML & "<html><body>"
viewAsHTML = viewAsHTML & "This is a custom View As HTML stream set by a postconversion script!"
viewAsHTML = viewAsHTML & "</body></html>"

' Set the View As HTML stream.
PostConversion.HTMLOutputToOverride.WriteString viewAsHTML

See also: What are Postconversion Scripts?, How to Create a Postconversion Script, How to Setup a Postconversion Script, Postconversion Script Samples