zoukankan
html css js c++ java
获取word文档或rtf格式文档的格式编码(可以应用此格式将字符以数据流的方式写入word或rtf文档)
/**/
///
<summary>
///
生成中文字符编码
///
</summary>
///
<param name="ChinaStr"></param>
///
<returns></returns>
private
string
GetCode(
string
ChinaStr)
{
string
str1
=
""
;
System.Windows.Forms.RichTextBox myRich1
=
new
RichTextBox();
myRich1.Text
=
ChinaStr;
myRich1.SelectAll();
ChinaStr
=
myRich1.SelectedRtf;
int
count1
=
ChinaStr.Length ;
int
start1
=
ChinaStr.IndexOf(
"
fs18
"
,
0
,count1);
if
(start1
==-
1
)
return
str1;
str1
=
ChinaStr.Substring(start1
+
4
,count1
-
start1
-
4
);
string
str3
=
@"
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
\viewkind4\uc1\pard\lang2052\fs18\f1
"
;
str1
=
str3
+
str1;
return
str1;
}
private
string
GetCode(
string
ChinaStr,System.Drawing.Font newFont )
{
string
str1
=
""
;
System.Windows.Forms.RichTextBox myRich1
=
new
RichTextBox();
myRich1.Font
=
newFont;
myRich1.Text
=
ChinaStr;
myRich1.SelectAll() ;
ChinaStr
=
myRich1.SelectedRtf;
int
count1
=
ChinaStr.Length ;
int
start1
=
ChinaStr.IndexOf(
@"
\fs
"
,
0
,count1);
if
(start1
==-
1
)
{
return
str1;
}
ChinaStr
=
ChinaStr.Insert(start1
+
5
,
@"
\f1
"
);
str1
=
ChinaStr ;
return
str1;
}
查看全文
相关阅读:
/etc/sysconfig/network-scripts/ifcfg-eth0
虚拟机不能上网
VMware3种网络模式
SecureCRT学习之道:用SecureCRT来上传和下载数据
SecureCRT学习之道:SecureCRT 常用技巧
SecureCRT学习之道:SecureCRT常用快捷键设置与字体设置方法
CentOS7 编译安装LNMP
提高PHP编程效率的方法
基于CentOS 5.4搭建nginx+php+spawn-fcgi+mysql高性能php平台
Linux系统部署规范v1.0
原文地址:https://www.cnblogs.com/furenjun/p/326521.html
最新文章
上传文件后获得文件属性
分页代码的一些注意事项
[转] php foreach用法和实例
使用foreach获取数据列表的全部信息
获得系统信息
sql函数
session和cookie个字消除的方法
制作验证码使用到的函数
sql编写注意
mt_rand()函数、str_shuffle() 函数、join() 函数
热门文章
VMware 11安装Mac OS X 10.10
VMware-WorkStation 去掉VM工具栏
CentOS 6.4安装(超级详细图解教程)
java项目打jar包
Mysql常用命令详解
为什么我的outlook只能收信不能发信,发送测试电子邮件消息: 无法发送此邮件。请在帐户属性中验证电子邮件
AFNetwork 作用和用法详解
TOMCAT的域名配置
java项目打jar包的两种情况
谁能告诉我war包的作用及使用方法。。。。。。
Copyright © 2011-2022 走看看