C# wordת»»³ÉHTML
C# wordת»»³ÉHTML
Ìí¼ÓcomÒýÓÃMicrosoft word 11.0 Object Library
Ìí¼Óusing System.Threading;using System.IO;
//ʵÀý»¯Ò»¸öWord
Microsoft.Office.Interop.Word.ApplicationClass appclass = new Microsoft.Office.Interop.Word.ApplicationClass();
Type wordtype = appclass.GetType();
Microsoft.Office.Interop.Word.Documents docs = appclass.Documents;//»ñÈ¡Document
Type docstype = docs.GetType();
object filename = @"E:\AA.doc";//WordÎļþµÄ·¾¶
Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docstype.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new object[] { filename, true, true });//´ò¿ªÎļþ
Type doctype = doc.GetType();
object savefilename = @"E:\bb.html";//Éú³ÉHTMLµÄ·¾¶ºÍÃû×Ó
doctype.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { savefilename, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML });//Áí´æÎªHtml¸ñʽ
wordtype.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, appclass, null);//Í˳ö
Thread.Sleep(3000);//ΪÁËʹÍ˳öÍêÈ«£¬ÕâÀï×èÈû3Ãë
StreamReader objreader = new StreamReader(savefilename.ToString(), System.Text.Encoding.GetEncoding("GB2312"));
//ÒÔÏÂÄÚÈÝÊÇΪÁËÔÚHtmlÖмÓÈë¶Ô±¾ÉíWordÎļþµÄÏÂÔØ
 
Ïà¹ØÎĵµ£º
Web¿Ø¼þÊÇ·ñÖ§³ÖÑùʽ±í£¨CSS£©ÄØ£¿
Ö§³Ö£¬ËùÓеÄWeb¿Ø¼þ¶¼´Ó»ùÀàSystem.Web.UI.WebControls.WebControlÖм̳ÐÁËÒ»¸ö½Ð×öCssClassµÄÊôÐÔ¡£
ʾÀýÔ´´úÂ룺
<html>
<head>
<style>
.Input { font: 10pt verdana; color: red; }
</style>
</head>
<body>
<form runat=& ......
Ò»¸öC# xml ÐòÁл¯´íÎó
Ê·¢ÏÖ³¡£º
xmlÐòÁл¯µÄÊý¾ÝÖд洢µÄ½ÚµãÊý¾ÝÊÇ
<Module>536870912</Module> £¨xmlÎļþÖУ©
¶ÔÓ¦µÄÀàÊôÐÔÊÇ
public short Module { get; set; } £¨C#ÀàÖУ©
ÐòÁл¯µÄ´úÂ룺
public static FMDSTimeSeriesDefinitio ......
Ò»¡¢ºǫ́£¨.csÎļþ£©·½·¨£º
public string GetString(string name)
{
return ("Hello " + name);
}
&n ......
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price& ......
´Ë½Ì³ÌÏòÄãÌṩ ASP.NET MVC ÊÓͼ¼ò½é, ÊÓͼÊý¾Ý, ºÍ HTML Helpers¡£½Ì³Ì×îºó£¬ÄãÓ¦¸Ã»áÀí½âÈçºÎ´´½¨ÐÂÊÓͼ£¬´Ó¿ØÖÆÆ÷´«µÝÊý¾Ýµ½ÊÓͼ£¬ºÍʹÓà use HTML Helpers ÔÚÊÓͼÖÐÉú³ÉÄÚÈÝ¡£
Àí½âÊÓͼ
²»Ïñ ASP.NET »òÕßASP, ASP.NET MVC ²¢²»°üÀ¨ÈκÎÖ±½Ó¶ÔÓ¦Ò³ÃæµÄ¶«Î÷¡£ ÔÚ ASP.NET MVC Ó¦ÓóÌÐòÖУ¬Ó²ÅÌÉϲ¢²»´ ......