当前位置: 首页 > news >正文

wordpress下载模板优化搜索引擎

wordpress下载模板,优化搜索引擎,广东东莞建设网,杭州网站建设maoeye本实例中的实例功能有: 1、 Aspose.Words.dll 插入模板指定域替换为文字或html标签,见1 2、Aspose.Words.dll 插入模板表格,使用的是邮件合并MailMerge功能,数据源是DataTable或List对象(将list转换成DataTable),见1和2 3、word转换Pdf文件,见1 4、将多个word输出文…

本实例中的实例功能有: 

1、 Aspose.Words.dll 插入模板指定域替换为文字或html标签,见1

2、Aspose.Words.dll 插入模板表格,使用的是邮件合并MailMerge功能,数据源是DataTable或List对象(将list转换成DataTable),见1和2

3、word转换Pdf文件,见1

4、将多个word输出文档合并成一个文档 ,见1

5、请求API 接口查询JSON数据 ,见3

6、翻页查询,T-SQL方法见2

1、准备工作:word模板,插入域

域插入方法:

1.1>WPS添加域,插入>>文档部件>>域>>邮件合并,见图一

1.2> Office Word添加域,插入>>文档部件>>域>>MergeField,见图二

2、效果图

3、Aspose.Words封装类:

using Aspose.Words;
using Aspose.Words.MailMerging;
using Aspose.Words.Saving;
using DS_SCZX.Common;
using DS_SCZX.Entities;
using DS_SCZX.Entities.GetObj;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;namespace DS_SCZX.BLL
{/// <summary>/// AsposeWordHelper插件的业务逻辑层/// </summary>public class AsposeWordHelper{readonly string key = "this your key";public AsposeWordHelper(){#region  许可证Aspose.Words.License license = new Aspose.Words.License();//签名license.SetLicense(new MemoryStream(Convert.FromBase64String(key)));#endregion}/// <summary>/// Word转PDF/// Author:Bingo/// Date:2024-07-31/// </summary>/// <param name="wordPath">word绝对路径</param>/// <param name="PDFPath">pdf要保存的绝对路径</param>/// <returns></returns>public MessageInfo WordToPDF(string wordPath, string PDFPath){var result = new MessageInfo();result.success = false;result.msg = "";if (string.IsNullOrEmpty(wordPath)){result.msg = "word路径不能为空";return result;}File.Exists(wordPath);if (!File.Exists(wordPath)){result.msg = "word文件不存在";return result;}//不带扩展名称的文件名称string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(wordPath);新合格证保存路径//string filePathTem = $@"C:\Codes\DS_SCZX\DS_SCZX\WordPDFiles\{fileNameWithoutExtension}.pdf";try{#region  实现Word转PDFAspose.Words.Document doc = new Aspose.Words.Document(wordPath);PdfSaveOptions options = new PdfSaveOptions();options.Compliance = PdfCompliance.Pdf17;// Convert Word to PDFdoc.Save(PDFPath, options);#endregionresult.msg = $@"/WordPDFiles/" + fileNameWithoutExtension + ".pdf";result.success = true;}catch (Exception ex){result.msg = ex.Message;}return result;}/// <summary>/// 合并word文档/// </summary>/// <param name="wordPaths">文档路径数组</param>/// <param name="outputPath">合并后的文件保存路径</param>public bool CombineWord(List<string> ListDocPath, string outputPath){bool b = false;try{Document mergedDocument = new Document(ListDocPath.FirstOrDefault());// 遍历要合并的文档路径for (int i = 1; i < ListDocPath.Count; i++){Document doc = new Document(ListDocPath[i]);mergedDocument.AppendDocument(doc, ImportFormatMode.UseDestinationStyles);}//保存文档mergedDocument.Save(outputPath);}catch (Exception){b = false;throw;}return b;测试合并文档//Document doc = new Document(wordItemUrl_out); //Document doc2 = new Document(wordItemUrl_out2);合并//doc.AppendDocument(doc2, ImportFormatMode.UseDestinationStyles);//string wordItemUrl_outALL = Server.MapPath($@"~/DownFiles/试验计划模板20240704/merged_document.docx");保存文档//doc.Save(wordItemUrl_outALL);}/// <summary>/// 将dataTable数据插入word文档/// Author:Bingo/// Date:2024-07-31/// </summary>/// <param name="wordPath">word模板文件路径</param>/// <param name="wordItemUrl2">word输出路径</param>/// <param name="dt2">数据源</param>/// <returns></returns>public MessageInfo InsertTable(string wordPath, string wordItemUrl2, DataTable dt2){var result = new MessageInfo();result.success = false;result.msg = "";if (string.IsNullOrEmpty(wordPath)){result.msg = "word模板路径不能为空";return result;}File.Exists(wordPath);if (!File.Exists(wordPath)){result.msg = "word模板文件不存在";return result;}try{#region  插入表数据Aspose.Words.Document doc = new Aspose.Words.Document(wordPath);Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);builder.MoveToMergeField("FirstTitle");builder.Write("01烧结-test");builder.MoveToMergeField("SecondTitle");builder.Wr
http://www.dt0577.cn/news/57278.html

相关文章:

  • 十大网站建立公司潍坊网站外包
  • 企业信用信息网公示网官网查询seo搜索引擎优化内容
  • 黄石有哪些做视觉网站的公司seo优化一般多少钱
  • wordpress 下载模板站天津百度网站排名优化
  • 游戏网站开发有限公司如何快速提升网站关键词排名
  • 网站设计语言有哪些百度站长工具验证
  • 书籍管理网站建设需求文档扬州seo
  • 商城小程序搭建seo关键词平台
  • 安徽安庆网站建设公司济南做网站公司哪家好
  • 网络规划设计师电子版教材优化大师官方免费下载
  • wordpress个人简历主题百度seo排名优化技巧分享
  • 58招聘运营网站怎么做网站建设教程
  • 风景旅游网站建设的设计思路快速优化关键词排名
  • 擦彩网站开发今日特大军事新闻
  • 上传的网站打不开百度如何推广网站
  • 网站备案主体查询企业网
  • 湖北省建设工程人力资源网站系统优化软件有哪些
  • 网站开发环境有哪些b2b免费推广平台
  • 网站加载不出来是什么原因seo综合查询 站长工具
  • access网站开发如何推广品牌知名度
  • 网站域名改了以后新域名301电商营销策划方案
  • wordpress作者增加页面权限北京百度推广排名优化
  • 保定市共青团下属网站搜索引擎营销流程是什么?
  • 2018做网站开发一个月工资多少国内新闻热点事件
  • 可信网站代码成人短期培训能学什么
  • wordpress 做网站有必要买优化大师会员吗
  • 提供徐州网站建设培训心得体会万能模板
  • 推荐网站在线看兄弟们软文台
  • 个人网站有哪些板块徐州网络推广服务
  • jsp ajax网站开发典型实例pdf项目网