RTF中的图片,想查找出来 用正则表达式能匹配出来吗,或其他办法{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
\viewkind4\uc1\pard\lang2052\f0\fs18 sdfds\f1{\object\objemb{\*\objclass Paint.Picture}\objw360\objh360{\*\objdata
01050000
.....
00000000
}{\result{\pict\wmetafile0
}}}\par
}
\viewkind4\uc1\pard\lang2052\f0\fs18 sdfds\f1{\object\objemb{\*\objclass Paint.Picture}\objw360\objh360{\*\objdata
01050000
.....
00000000
}{\result{\pict\wmetafile0
}}}\par
}
解决方案 »
- 如何从byte数组中判断编码方式
- 3小时5美元的广告歼击机~
- DataGrid控件问题
- 一个关于显示相同字段的问题,,急,,,解决就给分
- C#开发程序,用到了第三方控件,请问在打包时刻如何注册控件吗??用installshield打包...谢谢....
- 有两个问题求教,具体请进!
- 个关于WINFORM更新datagrid写库问题~谢谢!
- 在MS SQL里如何获取网络上的数据库服务器,像查询分析器那样可以进行服务器的选择
- 使用了盗版.net2003的C#开发了Web,其中用到crystalreport,,这样存在crystalreport的版权问题吗?
- 数据库连接问题,
- 圆角窗体,四个角弧度不一样,该怎么解决?
- 音乐电台,歌词下载怎么弄?
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace sxLdfang
{
class Program
{
static void Main(string[] args)
{
string html = @"{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
\viewkind4\uc1\pard\lang2052\f0\fs18 sdfds\f1{\object\objemb{\*\objclass Paint.Picture}\objw360\objh360{\*\objdata
01050000
.....
00000000
}{\result{\pict\wmetafile0
}}}\par
}";
string pattern = @"(?is)(?<={\\object\\objemb{\\\*\\objclass Paint\.Picture}\\objw\d+\\objh\d+{\\\*\\objdata).*(?=}{\\result{\\pict\\wmetafile0
}}}\\par)";
MatchCollection mc = Regex.Matches(html, pattern);
foreach (Match m in mc)
{
Console.WriteLine(m.Value);
}
Console.ReadKey();
}
}
}
运行结果:
01050000
.....
00000000
{\object\objemb{\*\objclass Paint.Picture}任意字符{\result{\pict\wmetafile0
}}}
string DestStr = ""; while (rtf.Contains(@"{\object\objemb{\*\objclass Paint.Picture}"))
{
DestStr += rtf.Substring(0, rtf.IndexOf(@"{\object\objemb{\*\objclass Paint.Picture}"));
rtf = rtf.Substring(rtf.IndexOf(@"{\object\objemb{\*\objclass Paint.Picture}") + @"{\object\objemb{\*\objclass Paint.Picture}".Length);
string temp = rtf.Substring(rtf.IndexOf(@"{\result{\pict\wmetafile0") + @"{\result{\pict\wmetafile0".Length + 6);
DestStr += "[##img##]";
rtf = rtf.Substring(rtf.IndexOf(@"{\result{\pict\wmetafile0") + @"{\result{\pict\wmetafile0".Length + 6);
}
return DestStr + rtf;