求一个导出word 方案 wordc#控件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用免费版本的Spire.Doc吧,不用安装庞大的Office,直接对文件操作。你可以Spire.Doc装载一个Word模板,然后填充数据,就可以生成你想要的word文档。http://www.e-iceblue.com/Introduce/word-for-net-introduce.html 把word的格式用html显示,然后用流导出 string path=@"C:\Documents and Settings\Administrator\桌面\2.doc"; FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("gb2312")); string html = @"C:\Documents and Settings\Administrator\桌面\1.html"; sw.WriteLine(File.ReadAllText(html)); sw.Close(); 到excel 也可以这样 先用word做好一个文档,排版好,预留下数据填充的位置,作为模板。导出的时候复制一份模板,在此基础上填入数据,保存。 能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然. 能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然.word要显示什么样,就用html显示什么样 用aspose.word 在word要插入数据的地方建好书签 然后程序控制向书签里放相应的数据 把Word文档中的表格数据导入到SQL Server数据库中 private Word.Application G_wa;//定义Word应用程序字段 private object G_missing = //定义G_missing字段并添加引用 System.Reflection.Missing.Value; private Thread G_th;//定义线程字段 private List<InstanceClass> G_List_InstanceClass = //定义数据集合字段并赋值 new List<InstanceClass>(); private void btn_display_Click(object sender, EventArgs e) { btn_display.Enabled = false; ThreadPool.QueueUserWorkItem(//开始线程池 (pp) =>//使用lambda表达式 { G_wa = new Microsoft.Office.Interop.Word.Application();//创建应用程序对象 G_wa.Visible = true;//CodeGo.net/ object P_Path = Directory.GetCurrentDirectory() + @"\Word.doc"; Word.Document P_Document = G_wa.Documents.Open(//打开Word文档 ref P_Path, ref G_missing, ref G_missing, ref G_missing , ref G_missing, ref G_missing, ref G_missing, ref G_missing , ref G_missing, ref G_missing, ref G_missing, ref G_missing , ref G_missing, ref G_missing, ref G_missing, ref G_missing); TrackData();//将Word数据更新到SQL }); } WPF 中 datagrid 的每个单元格的边框线如何去掉? 为什么复制文件的时候会退出软件? 关于ListView的应用 滑动条相关的事件是什么?? 请大家帮忙找下错误,怎么也找不出来啊。 动态增加的控件,并且制定的事件为什么没有用 重载"ExEcWB"方法未获取"2"参数 谁知道哪里有:应用了设计模式的优秀项目代码(供学习之用),给我提供点信息?(最好是c#的) 请教:如何让windows应用程序在启动时不显示窗体,只产生托盘图标? 如何使窗体激活,而非窗体上的控件激活? 如何改变字体大小? 如何比较两个List的同名属性的值?
string path=@"C:\Documents and Settings\Administrator\桌面\2.doc";
FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("gb2312"));
string html = @"C:\Documents and Settings\Administrator\桌面\1.html";
sw.WriteLine(File.ReadAllText(html));
sw.Close(); 到excel 也可以这样
能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然.
能有更详细的案例吗? 因为您这种方式我没有做过.光一句"把word的格式用html显示,然后用流导出" 我很茫然.
word要显示什么样,就用html显示什么样
private Word.Application G_wa;//定义Word应用程序字段
private object G_missing = //定义G_missing字段并添加引用
System.Reflection.Missing.Value;
private Thread G_th;//定义线程字段
private List<InstanceClass> G_List_InstanceClass = //定义数据集合字段并赋值
new List<InstanceClass>(); private void btn_display_Click(object sender, EventArgs e)
{
btn_display.Enabled = false;
ThreadPool.QueueUserWorkItem(//开始线程池
(pp) =>//使用lambda表达式
{
G_wa = new Microsoft.Office.Interop.Word.Application();//创建应用程序对象
G_wa.Visible = true;//CodeGo.net/
object P_Path = Directory.GetCurrentDirectory() + @"\Word.doc";
Word.Document P_Document = G_wa.Documents.Open(//打开Word文档
ref P_Path, ref G_missing, ref G_missing, ref G_missing
, ref G_missing, ref G_missing, ref G_missing, ref G_missing
, ref G_missing, ref G_missing, ref G_missing, ref G_missing
, ref G_missing, ref G_missing, ref G_missing, ref G_missing);
TrackData();//将Word数据更新到SQL
});
}