根据数据提供下载包含不同数据的word
2011-01-25 18:11
281 查看
1.实例化xml数据
static string ExportTemplate
{
get
{
if (__ExportTemplate == null)
{
string path = HttpContext.Current.Server.MapPath(Path.Combine("doc", "export.xml"));
using (StreamReader sr = new StreamReader(path))
{
__ExportTemplate = sr.ReadToEnd();
sr.Close();
sr.Dispose();
}
}
return __ExportTemplate;
}
}
private static string __ExportTemplate = null;
2.写入xml数据方法
String toWriteTxt = ;//写入word的字符串
// clear the current output content from the buffer
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=/"" + FileName + ".doc/"");
// 根据实际下载FileName修改,最好全部是英文
Response.ContentType = "application/octet-stream";
Response.Write(toWriteTxt);
Response.End();
3.动态加载
private String Export(String id)
{
/* 注释 */
View_Mov_Export cfpc = new View_Mov_Export();
cfpc.Load(string.Format("ID='{0}'", new Guid(id)));
//特殊字符处理
if(!string.IsNullOrEmpty(cfpc.ChineseName))
{
cfpc.ChineseName = cfpc.ChineseName.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.EnglishName))
{
cfpc.EnglishName = cfpc.EnglishName.Replace("&", "&");
}
if (!String.IsNullOrEmpty(cfpc.OriginName))
{
cfpc.OriginName = cfpc.OriginName.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.ProductionDirector))
{
cfpc.ProductionDirector = cfpc.ProductionDirector.Replace("&", "&");
}
if (!String.IsNullOrEmpty(cfpc.ProductionDirectorEN))
{
cfpc.ProductionDirectorEN = cfpc.ProductionDirectorEN.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.AwardsHistory))
{
cfpc.AwardsHistory = cfpc.AwardsHistory.Replace("&", "&");
} if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
{
cfpc.ScreenWriter = cfpc.ScreenWriter.Replace("&", "&");
}
FileName = cfpc.SN;
String toWriteTxt = ExportTemplate;
if (!string.IsNullOrEmpty(cfpc.SN))
{
toWriteTxt = toWriteTxt.Replace("##SN##", cfpc.SN);
}
else
{
toWriteTxt = toWriteTxt.Replace("##SN##", string.Empty);
}
if (cfpc.PublishTime != null && cfpc.PublishTime != DateTime.MinValue)
{
toWriteTxt = toWriteTxt.Replace("Publishtime", cfpc.PublishTime.ToString("yyyy年M月"));
}
else
{
toWriteTxt = toWriteTxt.Replace("Publishtime", string.Empty);
}
//if (cfpc.FirstShowDate != null)
// toWriteTxt = toWriteTxt.Replace("FirstShowDate", cfpc.FirstShowDate.ToString("yyyy年MM月dd日"));
//else
if (string.IsNullOrEmpty(cfpc.Length.ToString()) || cfpc.Length < 0)
toWriteTxt = toWriteTxt.Replace("FirstShowDate", "0 分钟");
else
toWriteTxt = toWriteTxt.Replace("FirstShowDate", cfpc.Length.ToString() + " 分钟");
if (!string.IsNullOrEmpty(cfpc.Category))
toWriteTxt = toWriteTxt.Replace("Category", getDisplayName(cfpc.Category, "SIFF_Basic_Category"));
else
toWriteTxt = toWriteTxt.Replace("Category", string.Empty);
//Nature: todo
/*
*
*
*
* **/
if (!string.IsNullOrEmpty(cfpc.OriginName))
toWriteTxt = toWriteTxt.Replace("OriginName",cfpc.OriginName);
else
toWriteTxt = toWriteTxt.Replace("OriginName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.EnglishName))
toWriteTxt = toWriteTxt.Replace("EnglishName", cfpc.EnglishName);
else
toWriteTxt = toWriteTxt.Replace("EnglishName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.ChineseName))
toWriteTxt = toWriteTxt.Replace("ChineseName", cfpc.ChineseName);
else
toWriteTxt = toWriteTxt.Replace("ChineseName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.Country))
toWriteTxt = toWriteTxt.Replace("ProducerCountry", getDisplayName(cfpc.Country, "SIFF_Country"));
else
toWriteTxt = toWriteTxt.Replace("ProducerCountry", string.Empty);
StringBuilder sbCoCountries = new StringBuilder();
if (!string.IsNullOrEmpty(cfpc.CoCountry) )
{
string[] countries = cfpc.CoCountry.Split(',');
if (countries.Length != 0)
{
foreach (string country in countries)
{
sbCoCountries.Append(getDisplayName(country, "SIFF_Country") + ",");
}
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", sbCoCountries.ToString().Substring(0, sbCoCountries.ToString().Length - 1));
}
else
{
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", string.Empty);
}
}
else
{
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", string.Empty);
}
toWriteTxt = toWriteTxt.Replace("ColorInfo", getDisplayName(cfpc.Color, "SIFF_Technique_Color")).Replace("AwardsHistory", cfpc.AwardsHistory);
toWriteTxt = toWriteTxt.Replace("SHShowType", getDisplayName(cfpc.SHShowType, "SIFF_Basic_SHShowType"));
//获得编剧名称: 优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriter.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN))
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN) && !string.IsNullOrEmpty(cfpc.ScreenWriter))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0] + "、" + cfpc.ScreenWriter.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriter.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("ScreenWriter", string.Empty);
* */
//摄影人名称:优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.Cameraman))
{
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.Cameraman.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.CameramanEN))
{
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("Cameraman", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.CameramanEN ) && !string.IsNullOrEmpty(cfpc.Cameraman ))
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0] + "、" + cfpc.Cameraman.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.CameramanEN))
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.Cameraman) )
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.Cameraman.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("Cameraman", string.Empty);
* */
//音乐人名称:优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.Musician))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.Musician.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.MusicianEN))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("Musician", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.MusicianEN ) && !string.IsNullOrEmpty(cfpc.Musician ))
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0] + "、" + cfpc.Musician.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.MusicianEN))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0]);
}
else if (!string.IsNullOrEmpty(cfpc.Musician) )
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.Musician.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("Musician", string.Empty);
*/
//Nature
string[] natures = cfpc.Nature.Split(',');
String NatureShow = string.Empty;
if (cfpc.Nature.Contains("GJDYZY"))
{
toWriteTxt = toWriteTxt.Replace("Nature2", "是");
}
else
{
toWriteTxt = toWriteTxt.Replace("Nature2", "否");
}
foreach (string str in natures)
{
//if (str != "GJDYZY")
//{
NatureShow += getDisplayName(str, "SIFF_Basic_Nature") + ",";
//}
}
try
{
toWriteTxt = toWriteTxt.Replace("Nature1", NatureShow.Substring(0, NatureShow.Length - 1));
}
catch (Exception)
{
toWriteTxt = toWriteTxt.Replace("Nature1", string.Empty);
}
//导入制片信息:优先显示中文名称,中文名称不存在,则显示相应的英文
toWriteTxt = getProducerInfo(id, toWriteTxt);
//导入演员信息
toWriteTxt = getActors(id, toWriteTxt);
//导出导演信息:优先显示中文名称,中文名称不存在,则显示相应的英文
DataTable dtDirector = DataAccess.Select(typeof(Mov_Participant_Director), string.Format("ID='{0}'", id));
if (dtDirector.Rows.Count == 0)
{
toWriteTxt = toWriteTxt.Replace("DirectorName", string.Empty);
toWriteTxt = toWriteTxt.Replace("DYB", string.Empty);
}
else if (dtDirector.Rows.Count >0 )
{
if (!string.IsNullOrEmpty(dtDirector.Rows[0]["Name"].ToString()))
{
toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["Name"].ToString().Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(dtDirector.Rows[0]["NameEn"].ToString()))
{
toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["NameEn"].ToString().Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("DirectorName", string.Empty);
}
}
// toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["NameEn"].ToString().Split('$')[0] + "、" + dtDirector.Rows[0]["Name"].ToString().Split('$')[0]);
toWriteTxt = toWriteTxt.Replace("DYB", getDisplayName(dtDirector.Rows[0]["Number"].ToString(), "SIFF_Participant_Number"));
}
//由于评定级别中有一个级别包含"&",所以不能直接替换,只需要把用户输入的字段进行处理。
//return toWriteTxt.Replace("&", "&");
return toWriteTxt;
}
static string ExportTemplate
{
get
{
if (__ExportTemplate == null)
{
string path = HttpContext.Current.Server.MapPath(Path.Combine("doc", "export.xml"));
using (StreamReader sr = new StreamReader(path))
{
__ExportTemplate = sr.ReadToEnd();
sr.Close();
sr.Dispose();
}
}
return __ExportTemplate;
}
}
private static string __ExportTemplate = null;
2.写入xml数据方法
String toWriteTxt = ;//写入word的字符串
// clear the current output content from the buffer
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=/"" + FileName + ".doc/"");
// 根据实际下载FileName修改,最好全部是英文
Response.ContentType = "application/octet-stream";
Response.Write(toWriteTxt);
Response.End();
3.动态加载
private String Export(String id)
{
/* 注释 */
View_Mov_Export cfpc = new View_Mov_Export();
cfpc.Load(string.Format("ID='{0}'", new Guid(id)));
//特殊字符处理
if(!string.IsNullOrEmpty(cfpc.ChineseName))
{
cfpc.ChineseName = cfpc.ChineseName.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.EnglishName))
{
cfpc.EnglishName = cfpc.EnglishName.Replace("&", "&");
}
if (!String.IsNullOrEmpty(cfpc.OriginName))
{
cfpc.OriginName = cfpc.OriginName.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.ProductionDirector))
{
cfpc.ProductionDirector = cfpc.ProductionDirector.Replace("&", "&");
}
if (!String.IsNullOrEmpty(cfpc.ProductionDirectorEN))
{
cfpc.ProductionDirectorEN = cfpc.ProductionDirectorEN.Replace("&", "&");
}
if (!string.IsNullOrEmpty(cfpc.AwardsHistory))
{
cfpc.AwardsHistory = cfpc.AwardsHistory.Replace("&", "&");
} if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
{
cfpc.ScreenWriter = cfpc.ScreenWriter.Replace("&", "&");
}
FileName = cfpc.SN;
String toWriteTxt = ExportTemplate;
if (!string.IsNullOrEmpty(cfpc.SN))
{
toWriteTxt = toWriteTxt.Replace("##SN##", cfpc.SN);
}
else
{
toWriteTxt = toWriteTxt.Replace("##SN##", string.Empty);
}
if (cfpc.PublishTime != null && cfpc.PublishTime != DateTime.MinValue)
{
toWriteTxt = toWriteTxt.Replace("Publishtime", cfpc.PublishTime.ToString("yyyy年M月"));
}
else
{
toWriteTxt = toWriteTxt.Replace("Publishtime", string.Empty);
}
//if (cfpc.FirstShowDate != null)
// toWriteTxt = toWriteTxt.Replace("FirstShowDate", cfpc.FirstShowDate.ToString("yyyy年MM月dd日"));
//else
if (string.IsNullOrEmpty(cfpc.Length.ToString()) || cfpc.Length < 0)
toWriteTxt = toWriteTxt.Replace("FirstShowDate", "0 分钟");
else
toWriteTxt = toWriteTxt.Replace("FirstShowDate", cfpc.Length.ToString() + " 分钟");
if (!string.IsNullOrEmpty(cfpc.Category))
toWriteTxt = toWriteTxt.Replace("Category", getDisplayName(cfpc.Category, "SIFF_Basic_Category"));
else
toWriteTxt = toWriteTxt.Replace("Category", string.Empty);
//Nature: todo
/*
*
*
*
* **/
if (!string.IsNullOrEmpty(cfpc.OriginName))
toWriteTxt = toWriteTxt.Replace("OriginName",cfpc.OriginName);
else
toWriteTxt = toWriteTxt.Replace("OriginName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.EnglishName))
toWriteTxt = toWriteTxt.Replace("EnglishName", cfpc.EnglishName);
else
toWriteTxt = toWriteTxt.Replace("EnglishName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.ChineseName))
toWriteTxt = toWriteTxt.Replace("ChineseName", cfpc.ChineseName);
else
toWriteTxt = toWriteTxt.Replace("ChineseName", string.Empty);
if (!string.IsNullOrEmpty(cfpc.Country))
toWriteTxt = toWriteTxt.Replace("ProducerCountry", getDisplayName(cfpc.Country, "SIFF_Country"));
else
toWriteTxt = toWriteTxt.Replace("ProducerCountry", string.Empty);
StringBuilder sbCoCountries = new StringBuilder();
if (!string.IsNullOrEmpty(cfpc.CoCountry) )
{
string[] countries = cfpc.CoCountry.Split(',');
if (countries.Length != 0)
{
foreach (string country in countries)
{
sbCoCountries.Append(getDisplayName(country, "SIFF_Country") + ",");
}
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", sbCoCountries.ToString().Substring(0, sbCoCountries.ToString().Length - 1));
}
else
{
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", string.Empty);
}
}
else
{
toWriteTxt = toWriteTxt.Replace("ProducercoCountry", string.Empty);
}
toWriteTxt = toWriteTxt.Replace("ColorInfo", getDisplayName(cfpc.Color, "SIFF_Technique_Color")).Replace("AwardsHistory", cfpc.AwardsHistory);
toWriteTxt = toWriteTxt.Replace("SHShowType", getDisplayName(cfpc.SHShowType, "SIFF_Basic_SHShowType"));
//获得编剧名称: 优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriter.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN))
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("ScreenWriter", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN) && !string.IsNullOrEmpty(cfpc.ScreenWriter))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0] + "、" + cfpc.ScreenWriter.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.ScreenWriterEN))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriterEN.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.ScreenWriter))
toWriteTxt = toWriteTxt.Replace("ScreenWriter", cfpc.ScreenWriter.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("ScreenWriter", string.Empty);
* */
//摄影人名称:优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.Cameraman))
{
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.Cameraman.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.CameramanEN))
{
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("Cameraman", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.CameramanEN ) && !string.IsNullOrEmpty(cfpc.Cameraman ))
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0] + "、" + cfpc.Cameraman.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.CameramanEN))
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.CameramanEN.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.Cameraman) )
toWriteTxt = toWriteTxt.Replace("Cameraman", cfpc.Cameraman.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("Cameraman", string.Empty);
* */
//音乐人名称:优先显示中文名称,中文名称不存在,则显示相应的英文
if (!string.IsNullOrEmpty(cfpc.Musician))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.Musician.Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(cfpc.MusicianEN))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("Musician", string.Empty);
}
}
/*
if (!string.IsNullOrEmpty(cfpc.MusicianEN ) && !string.IsNullOrEmpty(cfpc.Musician ))
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0] + "、" + cfpc.Musician.Split('$')[0]);
else if (!string.IsNullOrEmpty(cfpc.MusicianEN))
{
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.MusicianEN.Split('$')[0]);
}
else if (!string.IsNullOrEmpty(cfpc.Musician) )
toWriteTxt = toWriteTxt.Replace("Musician", cfpc.Musician.Split('$')[0]);
else
toWriteTxt = toWriteTxt.Replace("Musician", string.Empty);
*/
//Nature
string[] natures = cfpc.Nature.Split(',');
String NatureShow = string.Empty;
if (cfpc.Nature.Contains("GJDYZY"))
{
toWriteTxt = toWriteTxt.Replace("Nature2", "是");
}
else
{
toWriteTxt = toWriteTxt.Replace("Nature2", "否");
}
foreach (string str in natures)
{
//if (str != "GJDYZY")
//{
NatureShow += getDisplayName(str, "SIFF_Basic_Nature") + ",";
//}
}
try
{
toWriteTxt = toWriteTxt.Replace("Nature1", NatureShow.Substring(0, NatureShow.Length - 1));
}
catch (Exception)
{
toWriteTxt = toWriteTxt.Replace("Nature1", string.Empty);
}
//导入制片信息:优先显示中文名称,中文名称不存在,则显示相应的英文
toWriteTxt = getProducerInfo(id, toWriteTxt);
//导入演员信息
toWriteTxt = getActors(id, toWriteTxt);
//导出导演信息:优先显示中文名称,中文名称不存在,则显示相应的英文
DataTable dtDirector = DataAccess.Select(typeof(Mov_Participant_Director), string.Format("ID='{0}'", id));
if (dtDirector.Rows.Count == 0)
{
toWriteTxt = toWriteTxt.Replace("DirectorName", string.Empty);
toWriteTxt = toWriteTxt.Replace("DYB", string.Empty);
}
else if (dtDirector.Rows.Count >0 )
{
if (!string.IsNullOrEmpty(dtDirector.Rows[0]["Name"].ToString()))
{
toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["Name"].ToString().Split('$')[0]);
}
else
{
if (!string.IsNullOrEmpty(dtDirector.Rows[0]["NameEn"].ToString()))
{
toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["NameEn"].ToString().Split('$')[0]);
}
else
{
toWriteTxt = toWriteTxt.Replace("DirectorName", string.Empty);
}
}
// toWriteTxt = toWriteTxt.Replace("DirectorName", dtDirector.Rows[0]["NameEn"].ToString().Split('$')[0] + "、" + dtDirector.Rows[0]["Name"].ToString().Split('$')[0]);
toWriteTxt = toWriteTxt.Replace("DYB", getDisplayName(dtDirector.Rows[0]["Number"].ToString(), "SIFF_Participant_Number"));
}
//由于评定级别中有一个级别包含"&",所以不能直接替换,只需要把用户输入的字段进行处理。
//return toWriteTxt.Replace("&", "&");
return toWriteTxt;
}
相关文章推荐
- java 根据模板,导出word并提供下载
- java 根据模板,导出word并提供下载
- Struts2利用iText导出word文档(包含表格)以提供下载
- SQL语句增加虚拟字段,并根据情况显示不同的数据。。。(已阅。。。未阅。。)
- 不同应用程序提供的数据的获取显示—自定义ContentProvider
- 20150709---Web中GridView控件根据绑定的数据显示不同的图片
- 提供文华wh3 赢智程序化历史数据导出软件 破解200根k线的限制 包含1分钟 5分钟 15分钟等各种周期
- html5学习canvas基本使用:div在js前面;localStorage存储根据浏览器在不同的位置;应用程序缓存;placeholder 属性提供一种提示(hint),描述输入域所期待的值。
- 关于dorado框架datatable处的右键菜单无法根据具体数据实现动态分别显示不同菜单的解决方法
- 使用$.get()根据选项的不同从数据库异步请求数据
- java实现把数据库数据导出成word文件实现文件下载功能
- 使用ADO.net将数据导出到Excel并提供下载
- 根据select选项,显示不同的表单,进而提交显示的数据
- 润乾报表根据数据的不同扩展出列宽不同的格子
- php在程序中将网页生成word文档并提供下载的代码
- Cesium数据根据经纬度下载
- Linq从两个edmx(两个数据库)中选取数据进行查找出现错误解决 (指定的 LINQ 表达式包含对与不同上下文关联的查询)
- 根据word模版导出数据(2)
- elasticsearch 的mapping根据不同的数据格式设定属性
- WPF 根据Word模版导出数据到Word