随笔分类 -  c#操作Office

Excel合并单元格 NPOI实现
摘要:首先根据条件,记录需合并单元格的起始行和结束行 string oldCol0 = ""; //上一行的值,相同则合并 List<List<int>> mergs = new List<List<int>>(); //各段需合并的单元格行号 List<int> submerg = new List<i 阅读全文

posted @ 2021-02-20 19:29 mol1995 阅读(622) 评论(0) 推荐(0)

C#设置Excel行高、列宽
摘要:设置固定值 worksheet.Columns[1].ColumnWidth = 15; 设置自动换行 worksheet.Columns.WrapText = true; 设置自动行高、列宽 xlApp.Columns.AutoFit(); xlApp.Rows.AutoFit(); 对齐方式 w 阅读全文

posted @ 2019-08-16 22:36 mol1995 阅读(9794) 评论(1) 推荐(0)

设置标题级别
摘要:object st = wordApp.Selection.End;wordDoc.Range(ref st, ref st).set_Style(Word.WdBuiltinStyle.wdStyleHeading1); //设置标题属性只能设置整段,无法在某行局部设置标题属性,在某点设置标题,就 阅读全文

posted @ 2019-06-05 18:12 mol1995 阅读(424) 评论(0) 推荐(0)

C#操作Word的超详细总结
摘要:本文中用C#来操作Word,包括: 创建Word; 插入文字,选择文字,编辑文字的字号、粗细、颜色、下划线等; 设置段落的首行缩进、行距; 设置页面页边距和纸张大小; 设置页眉、页码; 插入图片,设置图片宽高以及给图片添加标题; 插入表格,格式化表格,往表格中插入数据; 保存Word,打印Word; 阅读全文

posted @ 2019-05-27 20:12 mol1995 阅读(959) 评论(0) 推荐(0)

通过PdfiumViewer.dll实现pdf直接从流显示(效果不好)
摘要:开源的PdfiumViewer.dll并不完整 需要不开源的pdfium.dll配合使用 引用只需添加PdfiumViewer.dll,但pdfium.dll必须跟它放在一个路径下 界面中添加控件: PdfiumViewer.PdfViewer pdfViewer1 = new PdfiumView 阅读全文

posted @ 2016-11-18 18:26 mol1995 阅读(8037) 评论(0) 推荐(0)

2015.5.21 VS2010中引用Word组件后提示 类型“Microsoft.Office.Interop.Word.ApplicationClass”未定义构造函数 解决方法
摘要:wordApp = new Word.ApplicationClass();//这句在VS2005中没问题,在2010中会报错。 解决方法:在资源管理器 “引用”项的"Microsoft.Office.Interop.Word" 上点击鼠标右键,选择“属性”,将属性中的“嵌入互操作类型”的值改为“f 阅读全文

posted @ 2016-10-15 17:30 mol1995 阅读(452) 评论(0) 推荐(0)

2014.10.1 Word技巧
摘要:设置每页都出现的表头 wordDoc.Tables[tab].Rows[1].HeadingFormat = (int)Word.WdConstants.wdToggle; //合并单元格 wordDoc.Tables[tab].Cell(row - dm.antms.Count, 1).Merge 阅读全文

posted @ 2016-10-15 17:02 mol1995 阅读(260) 评论(0) 推荐(0)

导航