本文整理汇总了C#中IHTMLDocument2.writeln方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDocument2.writeln方法的具体用法?C# IHTMLDocument2.writeln怎么用?C# IHTMLDocument2.writeln使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLDocument2
的用法示例。
在下文中一共展示了IHTMLDocument2.writeln方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenSourceFiles
/// <summary>
/// Open source files.
/// If they are not word, they will be converted to HTML.
/// </summary>
private void OpenSourceFiles()
{
MSWord msWord = null;
try
{
string archivoFinal = (string)Project.SourceFiles[0];
esWord = MSWord.ItIsWordDocument(archivoFinal);
dirHtml = null;
// Si es un documento word, convertirlo a HTML filtrado
if (esWord)
{
msWord = new MSWord();
archivoFinal = ConvertWordSourceFiles(msWord);
// Be sure we have closed word, to avoid overlapping between the html read
// and the reading from chmprocessor:
msWord.Dispose();
msWord = null;
}
else
// There is a single source HTML file.
MainSourceFile = (string)Project.SourceFiles[0];
if (CancellRequested())
return;
if (AppSettings.UseTidyOverInput)
new TidyParser(UI).Parse(archivoFinal);
if (CancellRequested())
return;
// Prepare loading:
HTMLDocumentClass docClass = new HTMLDocumentClass();
IPersistStreamInit ips = (IPersistStreamInit)docClass;
ips.InitNew();
// Create a timer, to be sure that HTML file load will not be hang up (Sometime happens)
timerTimeout = new System.Windows.Forms.Timer();
timerTimeout.Tick += new System.EventHandler(this.timer_Tick);
timerTimeout.Interval = 60 * 1000; // 1 minute
timerTimeout.Enabled = true;
// Load the file:
IHTMLDocument2 docLoader = (mshtml.IHTMLDocument2)docClass.createDocumentFromUrl( archivoFinal , null);
System.Windows.Forms.Application.DoEvents();
System.Threading.Thread.Sleep(1000);
String currentStatus = docLoader.readyState;
log("Reading file " + archivoFinal + ". Status: " + currentStatus , 2 );
while (currentStatus != "complete" && timerTimeout.Enabled)
{
System.Windows.Forms.Application.DoEvents();
System.Threading.Thread.Sleep(500);
String newStatus = docLoader.readyState;
if (newStatus != currentStatus)
{
log("Status: " + newStatus, 2);
if (currentStatus == "interactive" && newStatus == "uninitialized")
{
// fucking shit bug. Try to reload the file:
log("Warning. Something wrong happens loading the file. Trying to reopen " + archivoFinal , 2);
docClass = new HTMLDocumentClass();
ips = (IPersistStreamInit)docClass;
ips.InitNew();
docLoader = (mshtml.IHTMLDocument2)docClass.createDocumentFromUrl(archivoFinal, null);
newStatus = docLoader.readyState;
log("Status: " + newStatus, 2);
}
currentStatus = newStatus;
}
}
if (!timerTimeout.Enabled)
log("Warning: time to load file expired.", 1);
timerTimeout.Enabled = false;
// Get a copy of the document:
HTMLDocumentClass newDocClass = new HTMLDocumentClass();
iDoc = (IHTMLDocument2)newDocClass;
object[] txtHtml = { ((IHTMLDocument3)docLoader).documentElement.outerHTML };
iDoc.writeln(txtHtml);
try
{
// Needed, otherwise some characters will not be displayed well.
iDoc.charset = docLoader.charset;
}
catch (Exception ex)
{
log("Warning: Cannot set the charset \"" + docLoader.charset + "\" to the html document. Reason:" + ex.Message, 1);
log(ex);
}
}
finally
{
if (msWord != null)
//.........这里部分代码省略.........