高手求助C#输入出word设置格式

deng520159 2009-03-31 08:15:31
求一份,详细一点的C#输入出word 设置 格式,字体,颜色,对齐方式的例子程序
public void AppendText(string text)
{
Selection currentSelection = this.m_WordApp.Selection;
// Store the user's current Overtype selection
bool userOvertype = this.m_WordApp.Options.Overtype;
// Make sure Overtype is turned off.
if (this.m_WordApp.Options.Overtype)
{
this.m_WordApp.Options.Overtype = false;
}
// Test to see if selection is an insertion point.
if (currentSelection.Type == WdSelectionType.wdSelectionIP)
{
currentSelection.TypeText(text);
currentSelection.TypeParagraph();
}
else
if (currentSelection.Type == WdSelectionType.wdSelectionNormal)
{
// Move to start of selection.
if (this.m_WordApp.Options.ReplaceSelection)
{
object direction = WdCollapseDirection.wdCollapseStart;
currentSelection.Collapse(ref direction);
}
currentSelection.TypeText(text);
currentSelection.TypeParagraph();
}
else
{
// Do nothing.
}
// Restore the user's Overtype selection
this.m_WordApp.Options.Overtype = userOvertype;
}
...全文
110 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
deng520159 2009-04-02
  • 打赏
  • 举报
回复
自己解决了,求人不如求已
wuyq11 2009-03-31
  • 打赏
  • 举报
回复
http://lzh135yuhua.blog.163.com/blog/static/369490172008101825237826/

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧