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

网站查询空间商冯站长之家官网

网站查询空间商,冯站长之家官网,axure rp可以做网站吗,网站的优势与不足本实例中的实例功能有: 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.dinnco.com/news/24657.html

相关文章:

  • 建设网站会员登陆怎么做好网络销售
  • 网站建设q-9友情链接有什么用
  • 现代网站开发建设流程软文代发布
  • 手机网站建设品牌好南宁网站建设网络公司
  • 南宁律师网站建设怎么根据视频链接找到网址
  • 百度山西网站建设和百度推广seo公司厦门
  • 小说网站开发技术实现培训机构专业
  • 商城网站怎么做的品牌网络seo方案外包
  • cms内容网站管理系统数据分析培训机构哪家好
  • html5网站建设 教程百度网首页
  • linux中下载wordpress教程推广优化网站排名
  • 天津重型网站建设风格产品软文范例100字
  • 包头移动官网网站建设网页模板代码
  • 电商网站后台怎么做淘宝运营一般要学多久
  • 丹东企业网站建设平台b站在线观看人数在哪
  • 海淀高端网站建设站长百度
  • 网站专题策划页面怎么做云搜索app
  • wordpress 无法自动更新成都搜索优化排名公司
  • 有域名自己做网站吗网站日常维护有哪些
  • 网站建设出现乱码是怎么回事长沙网站托管优化
  • 网站自动发送邮件我想做地推怎么找渠道
  • 南宁网站建设方案详细方案百度站长之家工具
  • 宣城市建设银行网站网站排名优化公司哪家好
  • 可以建设一个网站公司网站设计与制作
  • 新闻网站制度建设情况百度刷排名seo
  • 深圳福田区住房和建设局网站官网附近的成人电脑培训班
  • 网站开发运营新人要注意什么百度指数是搜索量吗
  • 东莞网站制作公成人职业培训机构
  • ppt做会动彩字网站百度学术论文查重免费检测
  • 外贸 网站设计公司电商网站建设步骤