Article ID: 195173
Article Last Modified on 6/14/2006
import com.ms.wfc.html.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
public class Class1 extends DhDocument
{
public Class1()
{
initForm();
}
private void initForm()
{
}
protected void onDocumentLoad(Object sender, Event e)
{
DhButton button=new DhButton("button");
add(button);
this.dumpDHTML(null,null);
// Workaround1: Uncomment the next line and comment the above line.
// You must have a "c:\temp" directory or change the directory below.
// showHTML("c:\\temp\\");
// Workaround2: Uncomment the next line and comment the above line.
// You must have a blank.htm in the current directory.
// showHTML();
}
public void showHTML(String directory) {
String filename=directory+"__dump.txt";
addText(filename);
com.ms.wfc.io.File outputFile =
com.ms.wfc.io.File.create(filename);
writeHTML(outputFile);
outputFile.close();
getWindow().open(filename,"dump",null,false);
}
public void showHTML() {
// You must have a "blank.htm" in the current directory
DhWindow window=getWindow().open("blank.htm","dump",null,false);
DhDocument document=window.getDocument();
String x=getHTML();
document.add(new DhRawHTML(toHTMLViewable(getHTML())));
}
static String toHTMLViewable(String text) {
// indexOf() returns -1 if not found:
if (text.indexOf('<')+text.indexOf('>')+text.indexOf('&')==-3)
return text;
StringBuffer buffer=new StringBuffer(text);
int index=0;
String amp="amp;";
String less="lt;";
String greater="gt;";
while (buffer.length()>index) {
if (buffer.charAt(index)=='&') {
buffer.insert(index+1,amp);
} else if (buffer.charAt(index)=='<') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,less);
} else if (buffer.charAt(index)=='>') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,greater);
}
index++;
}
return buffer.toString();
}
}
<HTML>
<BODY>
<hr>
<OBJECT classid="java:com.ms.wfc.html.DhModule"
height=0 width=0 ... VIEWASTEXT>
<PARAM NAME=__CODECLASS VALUE=Class1>
<PARAM NAME=CABBASE VALUE=Project1.CAB>
</OBJECT>
<!-- Insert HTML here -->
</BODY>
</HTML>
Keywords: kbbug kbfix kbjava kbhtml kbdhtml kbwfc kbvs600sp3fix KB195173