不同的格式到一个单一的线Interop.word [英] different format into one single line Interop.word

查看:123
本文介绍了不同的格式到一个单一的线Interop.word的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图找出如何在C#像这样使用interop.word插入2个不同的格式转换成同款:

I've been trying to figure out how to insert 2 different formats into the same paragraph using interop.word in c# like this:

您好星球的地球这里就是我想要做的。

hello planet earth here's what I want to do

推荐答案

假设你有你的文档定义为沃达柯,下面code应该得到你想要的结果:

Assuming you have your document defined as oDoc, the following code should get you the desired result:

Word.Paragraph oPara = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara.Range.Text = "hello planet earth here's what I want to do";
object oStart = oPara.Range.Start + 13;
object oEnd = oPara.Range.Start + 18;

Word.Range rBold = oDoc.Range(ref oStart, ref oEnd);
rBold.Bold = 1;

这篇关于不同的格式到一个单一的线Interop.word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆