/// <summary>
/// 获取RTF格式字符串中的二进制图片字符串列表
/// </summary>
/// <param name="_RtfText">富文本字符串</param>
/// <returns></returns>
public static IList<string> GetImageStrList(string _RtfText)
{
IList<string> _ImageList = new List<string>();
while (true)
{
int _Index = 0;
_Index = _RtfText.IndexOf("pichgoal");
if (_Index == -1) break;
_RtfText = _RtfText.Remove(0, _Index + 8);
_Index = _RtfText.IndexOf("\r\n");
if (_Index > -1)
_RtfText = _RtfText.Remove(0, _Index);
else
break;
_Index = _RtfText.IndexOf("}");
_ImageList.Add(_RtfText.Substring(0, _Index).Replace("\r\n", ""));
_RtfText = _RtfText.Remove(0, _Index);
}
return _ImageList;
}
/// 获取RTF格式字符串中的二进制图片字符串列表
/// </summary>
/// <param name="_RtfText">富文本字符串</param>
/// <returns></returns>
public static IList<string> GetImageStrList(string _RtfText)
{
IList<string> _ImageList = new List<string>();
while (true)
{
int _Index = 0;
_Index = _RtfText.IndexOf("pichgoal");
if (_Index == -1) break;
_RtfText = _RtfText.Remove(0, _Index + 8);
_Index = _RtfText.IndexOf("\r\n");
if (_Index > -1)
_RtfText = _RtfText.Remove(0, _Index);
else
break;
_Index = _RtfText.IndexOf("}");
_ImageList.Add(_RtfText.Substring(0, _Index).Replace("\r\n", ""));
_RtfText = _RtfText.Remove(0, _Index);
}
return _ImageList;
}
本文介绍了一种从RTF格式文本中提取二进制图片的方法。通过解析富文本字符串,该方法能够有效地找到并分离出所有内嵌的图片数据。
1105

被折叠的 条评论
为什么被折叠?



