获取word文档或rtf格式文档的格式编码(可以应用此格式将字符以数据流的方式写入word或rtf文档)...

ExpandedBlockStart.gif ContractedBlock.gif /**/ /// <summary>
InBlock.gif        
/// 生成中文字符编码
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="ChinaStr"></param>
ExpandedBlockEnd.gif        
/// <returns></returns>

None.gif          private   string  GetCode( string  ChinaStr)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
string str1="";
InBlock.gif            System.Windows.Forms.RichTextBox myRich1
=new RichTextBox();
InBlock.gif            myRich1.Text
=ChinaStr;
InBlock.gif            myRich1.SelectAll();
InBlock.gif            ChinaStr
=myRich1.SelectedRtf;
InBlock.gif            
int count1=ChinaStr.Length ;
InBlock.gif            
int start1=ChinaStr.IndexOf("fs18",0,count1);
InBlock.gif            
if (start1==-1)
InBlock.gif                
return str1;
InBlock.gif            str1
=ChinaStr.Substring(start1+4,count1-start1-4);
InBlock.gif            
InBlock.gif            
string str3=@"{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
InBlock.gif\viewkind4\uc1\pard\lang2052\fs18\f1
";
InBlock.gif            str1
=str3+str1;
InBlock.gif            
return str1;
InBlock.gif  
ExpandedBlockEnd.gif        }

None.gif
None.gif        
private   string  GetCode( string  ChinaStr,System.Drawing.Font newFont  )
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
string str1="";
InBlock.gif            System.Windows.Forms.RichTextBox myRich1
=new RichTextBox();
InBlock.gif            myRich1.Font 
=newFont;
InBlock.gif            myRich1.Text
=ChinaStr;
InBlock.gif            myRich1.SelectAll()  ;
InBlock.gif            ChinaStr
=myRich1.SelectedRtf;
InBlock.gif            
int count1=ChinaStr.Length ;
InBlock.gif            
int start1=ChinaStr.IndexOf(@"\fs",0,count1);
InBlock.gif            
if (start1==-1)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
InBlock.gif                
return str1;
ExpandedSubBlockEnd.gif            }

InBlock.gif            ChinaStr
=ChinaStr.Insert(start1+5,@"\f1");
InBlock.gif          
InBlock.gif            str1
=ChinaStr ;
InBlock.gif
InBlock.gif            
return str1;
InBlock.gif  
ExpandedBlockEnd.gif        }
posted on 2006-02-07 13:41 DotNet编程 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/furenjun/archive/2006/02/07/326521.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值