asp.net c# 帮我把 这个读取word 的程序代码具体解释一下 不懂啊
privatestringReadDoc(){stringguid=Guid.NewGuid().ToString();stringsys_Path=System.Web...
private string ReadDoc()
{
string guid=Guid.NewGuid().ToString();
string sys_Path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + myCollection.SelectedValue.Replace("/", "\\");
Aspose.Words.Document doc = new Aspose.Words.Document(sys_Path);
string p=Path.Combine(Request.PhysicalApplicationPath, "thesises\\")+guid+".html";
doc.Save(p, Aspose.Words.SaveFormat.Html);
string s= Reader(p);
Match mc = Regex.Match(s, @"<body>[\s\S]*?<\/body>", RegexOptions.IgnoreCase);
Delete(p);
return mc.Groups[0].Value;
} 展开
{
string guid=Guid.NewGuid().ToString();
string sys_Path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + myCollection.SelectedValue.Replace("/", "\\");
Aspose.Words.Document doc = new Aspose.Words.Document(sys_Path);
string p=Path.Combine(Request.PhysicalApplicationPath, "thesises\\")+guid+".html";
doc.Save(p, Aspose.Words.SaveFormat.Html);
string s= Reader(p);
Match mc = Regex.Match(s, @"<body>[\s\S]*?<\/body>", RegexOptions.IgnoreCase);
Delete(p);
return mc.Groups[0].Value;
} 展开
1个回答
展开全部
创建Aspose.Words.Document doc = new Aspose.Words.Document(sys_Path); word文档
string p=Path.Combine(Request.PhysicalApplicationPath, "thesises\\")+guid+".html";
转换html
doc.Save(p, Aspose.Words.SaveFormat.Html);
保存html
string s= Reader(p);替换数据
Match mc = Regex.Match(s, @"<body>[\s\S]*?<\/body>", RegexOptions.IgnoreCase);
用正则表达式匹配数据
Delete(p);
删除数据
mc.Groups[0].Value
返回匹配到的第一个值
string p=Path.Combine(Request.PhysicalApplicationPath, "thesises\\")+guid+".html";
转换html
doc.Save(p, Aspose.Words.SaveFormat.Html);
保存html
string s= Reader(p);替换数据
Match mc = Regex.Match(s, @"<body>[\s\S]*?<\/body>", RegexOptions.IgnoreCase);
用正则表达式匹配数据
Delete(p);
删除数据
mc.Groups[0].Value
返回匹配到的第一个值
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询