高效而稳定的企业级.NET Office 组件Spire

 

  在项目开发中,尤其是企业的业务系统中,对文档的操作是非常多的,有时几乎给人一种错觉的是”这个系统似乎就是专门操作文档的“。毕竟现在的很多办公中大都是在PC端操作文档等软件,在这些庞大而繁重的业务中,单单依靠人力去做文档的操作需要的代价是巨大的,比如数据统计,数据分析等业务要求。这就需要我们在开发系统时,应该尽量减少使用者的一些工作量,例如将数据直接写入文档,获取网页信息后直接存为PDF保存,以便以后继续查看。软件开发的目地是对使用者便捷,但这一要求未必对开发者来说也是便捷的。

在前面介绍过一款开源免费的组件DocX,这个组件主要是对文档进行操作。另一种对Excel操作的组件NPOI组件。今天介绍一款.NET Office操作组件Spire,这是一个企业级的.NET Office操作组件,但是这是一款不免费也不开源的组件。可能很多人听到这里就不想再读下去了,的确,在国内毕竟免费才可以占用主流市场,因为很多客户希望减少成本,所以希望采用免费的工具。

作为开发者,我也会有这样的观点,不过有的时候也会思考收费与免费的工具到底哪一个好,其实这样的思考到最后似乎是没有意义的,因为事物存在既有价值,免费的可以减少成本,收费的可以获取稳定而安全的支持,各有优势和特点。任何一个软件的生成都是需要成本的,因为任何软件都是人员开发出来的,需要支付对应的成本,此处不收钱,其他的地方也会收费。无论收费与免费的哪一个好,技术总是没有错的,收费的东西,我们也可以了解,做一个技术储备。

今天要介绍的一款组件有收费的部分和免费的部分,但是这款软件的功能的确比较的强大,使用起来也比较简单,因为要收费的东西,毕竟需要做到人性化,不然谁会出钱去买,毕竟便宜而好用的东西很少。此组件的使用方式很简单,官方提供了比较完备的操作demo,所以今天的文章只做为一个引子。

由于Spire的组件较多,今天就用Spire.PDF for .NET做个引子,不一定收费就没有客户会选择,如果需要稳定的服务支持,收费的组件是可以考虑的,或者遇到土豪客户,也可以在项目中使用一下,毕竟使用起来很便捷。

一.Spire.PDF for .NET组件概述:

Spire.PDF for .NET是一个专业的PDF组件,用于在.NET应用程序中创建,编写,编辑,处理和阅读PDF文件,而不需要任何外部依赖。 使用这个.NET PDF库,您可以实现丰富的功能从头开始创建PDF文件或完全通过C#/ VB.NET处理现有的PDF文档,而无需安装Adobe Acrobat。

.NET PDF API支持许多丰富的功能,例如安全设置(包括数字签名),PDF文本/附件/图像提取,PDF合并/拆分,元数据更新,段,图像/图像绘制和插入,表创建 以及处理和导入数据等。

此外,Spire.PDF for .NET可以应用于使用C#/ VB.NET以高质量轻松地将文本,图像和HTML转换为PDF。

以下是一个官方给出的组件解析图:

Spire.PDF for .NET支持将HTML,RTF,XPS,文本和图像转换为具有高效性能的PDF文档。 开发人员可以将PDF转换为Word,XPS,SVG,EMF,JPG,PNG,BMP,TIFF,文本格式。 此外,随着Spire.Doc for .NET和Spire.XLS for .NET,开发人员可以将Word(Doc / Docx),Excel(Xls / Xlsx)和XML转换为PDF。

此组件的功能还是非常强大的,每个开发人员都知道,产品做得不好,想要客户的钱还是很难的。看一下组件的主要功能:

    1.文本格式,多语言支持,文本对齐等。

    2.笔和画笔将形状元素,文本,图像绘制成PDF文档。

    3.图层,透明图形,颜色空间和条形码创建可以呈现为PDF文档。

    4.PDF / A-1b和PDF / x1a:2001合规性,可以应用这两种标准。

    5.添加标量/矢量图像和掩码,并将它们放在指定的位置。

    6.Spire.PDF for .NET可支持表和表样式

    7.插入交互式元素,包括注释,操作,JavaScript,附件,书签和指定地点和外观。

以上对组件的相关背景做了一个简单的介绍,并且对组件的功能和使用情形做了简单的罗列。

二.Spire.PDF for .NET相关类的解析:

在这里主要介绍Spire的Spire.PDF组件部分,此组件有免费的和收费的两个版本,免费的版本在功能没有收费的多,但是稳定性和实用性还是较高的。我们具体看一下此组件的主要的类和方法,这里是主要介绍PDF的操作,就先看一下有关PDF的操作类和方法。

这里看以下命名空间的主要类:

以上的方法中只是操作PDF部分类,由于包含的类较多,过大的介绍篇幅就显得多余,在对PDF的操作中提供了较多的方法,因此在功能上会较为的丰富,使用起来也较为的便捷。

1.PdfDocument类:声明PDF文档:

     (1).PdfDocument类的构造函数:

  1. public PdfDocument();
  2. public PdfDocument(string filename);
  3. public PdfDocument(byte[] bytes);
  4. public PdfDocument(Stream stream);
  5. public PdfDocument(string filename, string password);
  6. public PdfDocument(byte[] bytes, string password);
  7. public PdfDocument(Stream stream, string password);
  8.  
  9. 该类提供了7个构造函数的重载版本,对应的参数类型就不做详细的介绍

(2).PdfDocument.LoadFromHTML():加载HTML页面:

  1. public void LoadFromHTML(string Url, bool enableJavaScript, bool enableHyperlinks, bool autoDetectPageBreak)
  2. {
  3. // This item is obfuscated and can not be translated.
  4. PdfHtmlLayoutFormat format;
  5. int num;
  6. goto Label_001E;
  7. Label_008F:
  8. num = 0;
  9. Label_0002:
  10. switch (num)
  11. {
  12. case 0:
  13. break;
  14.  
  15. case 1:
  16. if (!autoDetectPageBreak)
  17. {
  18. format.Layout = PdfLayoutType.OnePage;
  19. format.FitToPage = Clip.Width;
  20. format.FitToHtml = Clip.Height;
  21. num = 2;
  22. }
  23. else
  24. {
  25. num = 3;
  26. }
  27. goto Label_0002;
  28.  
  29. case 2:
  30. switch ((1 == 1))
  31. {
  32. case 2:
  33. goto Label_008F;
  34. }
  35. if (0 != 0)
  36. {
  37. }
  38. break;
  39.  
  40. case 3:
  41. format.Layout = PdfLayoutType.Paginate;
  42. format.FitToPage = Clip.Width;
  43. goto Label_008F;
  44.  
  45. default:
  46. goto Label_001E;
  47. if (1 != 0)
  48. {
  49. }
  50. format = new PdfHtmlLayoutFormat();
  51. num = 1;
  52. goto Label_0002;
  53. }
  54. this.Sections.Add().LoadFromHTML(Url, enableJavaScript, enableHyperlinks, format);
  55. }

2.HtmlConverter名称空间:Html转换器。

  1. namespace Spire.Pdf.HtmlConverter
  2. {
  3. public enum AspectRatio
  4.  
  5. public enum Clip
  6.  
  7. [ToolboxItem(false)]
  8. public class HtmlConverter : UserControl, sprᰐ, sprᶪ, sprṳ, sprẝ, spr
  9.  
  10. public enum ImageType
  11.  
  12. public class PdfHtmlLayoutFormat
  13. }
  1. private Metafile ᜍ();
  2. static HtmlConverter();
  3. public HtmlConverter();
  4. public int Authenticate(ref IntPtr phwnd, ref IntPtr pszUsername, ref IntPtr pszPassword);
  5. public HtmlToPdfResult Convert(string url, ImageType type, int width, int height, AspectRatio aspectRatio);
  6. public HtmlToPdfResult Convert(string html, string baseurl, ImageType type, int width, int height, AspectRatio aspectRatio);
  7. public HtmlToPdfResult Convert(string url, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password);
  8. public Image ConvertToImage(string url, ImageType type);
  9. public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type);
  10. public Image ConvertToImage(string url, ImageType type, int width);
  11. public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width);
  12. public Image ConvertToImage(string url, ImageType type, int width, int height);
  13. public Image ConvertToImage(string url, ImageType type, string username, string password);
  14. public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width, int height);
  15. public Image ConvertToImage(string url, ImageType type, int width, int height, AspectRatio aspectRatio);
  16. public Image ConvertToImage(string url, ImageType type, int width, string username, string password);
  17. public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width, int height, AspectRatio aspectRatio);
  18. public Image ConvertToImage(string url, ImageType type, int width, int height, string username, string password);
  19. public Image ConvertToImage(string url, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password);
  20. [DispId(-5512)]
  21. public int CustomizeDownload();
  22. protected override void Dispose(bool disposing);
  23. public Image FromString(string html, ImageType type, int width);
  24. public Image FromString(string html, string baseUrl, ImageType type);
  25. public Image FromString(string html, ImageType type, int width, int height);
  26. public Image FromString(string html, string baseUrl, ImageType type, int width);
  27. public Image FromString(string html, ImageType type, int width, int height, AspectRatio aspectRatio);
  28. public Image FromString(string html, string baseUrl, ImageType type, int width, int height);
  29. public Image FromString(string html, string baseUrl, ImageType type, int width, int height, AspectRatio aspectRatio);
  30. public Image FromString(string html, string baseUrl, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password);
  31. public Image[] GetImagesFromString(string html, string baseUrl, ImageType type);
  32. public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject);int sprẏ.GetSecurityId(string pwszUrl, IntPtr pbSecurityId, ref uint pcbSecurityId, ref uint dwReserved);
  33. int sprẏ.GetSecuritySite(out IntPtr pSite);
  34. int sprẏ.GetZoneMappings(uint dwZone, out IEnumString ppenumString, uint dwFlags);
  35. int sprẏ.MapUrlToZone(string pwszUrl, out uint pdwZone, uint dwFlags);
  36. int sprẏ.ProcessUrlAction(string pwszUrl, uint dwAction, IntPtr pPolicy, uint cbPolicy, IntPtr pContext, uint cbContext, uint dwFlags, uint dwReserved);
  37. int sprẏ.QueryCustomPolicy(string pwszUrl, ref Guid guidKey, out IntPtr ppPolicy, out uint pcbPolicy, IntPtr pContext, uint cbContext, uint dwReserved);
  38. int sprẏ.SetSecuritySite(IntPtr pSite);
  39. int sprẏ.SetZoneMapping(uint dwZone, string lpszPattern, uint dwFlags);
  40. int sprᶪ.GetContainer(object ppContainer);
  41. int sprᶪ.GetMoniker(uint dwAssign, uint dwWhichMoniker, object ppmk);
  42. int sprᶪ.OnShowWindow(bool fShow);
  43. int sprᶪ.RequestNewObjectLayout();
  44. int sprᶪ.SaveObject();
  45. int sprᶪ.ShowObject();

以上是对PDF操作的相关类和方法的查看,由于此软件为商业软件,只能查看部分对外公开的代码,但是从可以查看到的代码就可以看出其内部实现的复杂度。如果需要详细了解:http://www.e-iceblue.com/Introduce/free-pdf-component.html#.WEEFj_l962w。

三.Spire.PDF for .NET实例:

由于本文主要讲解HTML页面转换为PDF文档,所以先提供一种GET请求HTML页面,以及一种获取页面图片的操作方法。接着介绍创建PDF文档、Text转化为PDF, XPS转换为

PDF,Image转换为PDF等操作方法。

1.创建HTTP的GET请求,获取网页信息:

  1. /// <summary>
  2. /// 指定路径发送GET请求
  3. /// </summary>
  4. /// <param name="getUrl"></param>
  5. /// <returns></returns>
  6. public static string HttpGet(string getUrl)
  7. {
  8. try
  9. {
  10. if (string.IsNullOrEmpty(getUrl))
  11. throw new ArgumentNullException(getUrl);
  12. var request = WebRequest.Create(getUrl) as HttpWebRequest;
  13. if (request == null)
  14. return null;
  15. var cookieContainer = new CookieContainer();
  16. request.CookieContainer = cookieContainer;
  17. request.AllowAutoRedirect = true;
  18. request.Method = "GET";
  19. request.ContentType = "application/x-www-form-urlencoded";
  20. var response = request.GetResponse() as HttpWebResponse;
  21. if (response != null)
  22. {
  23. var instream = response.GetResponseStream();
  24. if (instream == null)
  25. throw new ArgumentNullException("getUrl");
  26. string content;
  27. using (var sr = new StreamReader(instream, Encoding.UTF8))
  28. {
  29. content = sr.ReadToEnd();
  30. }
  31. return content;
  32. }
  33. }
  34. catch (Exception er)
  35. {
  36. throw new Exception(er.Message);
  37. }
  38. return null;
  39. }

2.取得HTML中所有图片的 URL:

  1. /// <summary>
  2. /// 取得HTML中所有图片的 URL。
  3. /// </summary>
  4. /// <param name="url">HTML代码</param>
  5. /// <returns>图片的URL列表</returns>
  6. public static string HtmlCodeRequest(string url)
  7. {
  8. if (string.IsNullOrEmpty(url))
  9. {
  10. throw new ArgumentNullException(url);
  11. }
  12. try
  13. {
  14. //创建一个请求
  15. var httprequst = (HttpWebRequest)WebRequest.Create(url);
  16. //不建立持久性链接
  17. httprequst.KeepAlive = true;
  18. //设置请求的方法
  19. httprequst.Method = "GET";
  20. //设置标头值
  21. httprequst.UserAgent = "User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705";
  22. httprequst.Accept = "*/*";
  23. httprequst.Headers.Add("Accept-Language", "zh-cn,en-us;q=0.5");
  24. httprequst.ServicePoint.Expect100Continue = false;
  25. httprequst.Timeout = 5000;
  26. //是否允许302
  27. httprequst.AllowAutoRedirect = true;
  28. ServicePointManager.DefaultConnectionLimit = 30;
  29. //获取响应
  30. var webRes = (HttpWebResponse)httprequst.GetResponse();
  31. //获取响应的文本流
  32. string content;
  33. using (var stream = webRes.GetResponseStream())
  34. {
  35. using (var reader = new StreamReader(stream, Encoding.GetEncoding("utf-8")))
  36. {
  37. content = reader.ReadToEnd();
  38. }
  39. }
  40. //取消请求
  41. httprequst.Abort();
  42. //返回数据内容
  43. return content;
  44. }
  45. catch (Exception ex)
  46. {
  47. throw new Exception(ex.Message);
  48. }
  49. }

3.创建PDF文档:

  1. PdfDocument doc = new PdfDocument();
  2.  
  3. doc.LoadFromHTML(url, false, true, true);
  4.  
  5. doc.Close();
  6.  
  7. 以上没有将操作组装为一个方法,由于创建操作较为简单,所以不做详细介绍,url为网页路径地址。
  1. HtmlConverter.Convert
  2. ("http://www.wikipedia.org/","HTMLtoPDF.pdf",
  3. //enable javascript
  4. true,
  5. //load timeout
  6. 100 * 1000,
  7. //page size
  8. new SizeF(612, 792),
  9. //page margins
  10. new PdfMargins(0, 0));

4.Text转化为PDF:

  1. public static void TextLayout()
  2. {
  3. //Create a pdf document.
  4. PdfDocument doc = new PdfDocument();
  5.  
  6. // Create one page
  7. PdfPageBase page = doc.Pages.Add();
  8. float pageWidth = page.Canvas.ClientSize.Width;
  9. float y = 0;
  10.  
  11. //page header
  12. PdfPen pen1 = new PdfPen(Color.LightGray, 1f);
  13. PdfBrush brush1 = new PdfSolidBrush(Color.LightGray);
  14. PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial", 8f, FontStyle.Italic));
  15. PdfStringFormat format1 = new PdfStringFormat(PdfTextAlignment.Right);
  16. String text = "Demo of Spire.Pdf";
  17. page.Canvas.DrawString(text, font1, brush1, pageWidth, y, format1);
  18. SizeF size = font1.MeasureString(text, format1);
  19. y = y + size.Height + 1;
  20. page.Canvas.DrawLine(pen1, 0, y, pageWidth, y);
  21.  
  22. //title
  23. y = y + 5;
  24. PdfBrush brush2 = new PdfSolidBrush(Color.Black);
  25. PdfTrueTypeFont font2 = new PdfTrueTypeFont(new Font("Arial", 16f, FontStyle.Bold));
  26. PdfStringFormat format2 = new PdfStringFormat(PdfTextAlignment.Center);
  27. format2.CharacterSpacing = 1f;
  28. text = "Summary of Science";
  29. page.Canvas.DrawString(text, font2, brush2, pageWidth / 2, y, format2);
  30. size = font2.MeasureString(text, format2);
  31. y = y + size.Height + 6;
  32.  
  33. //icon
  34. PdfImage image = PdfImage.FromFile(@"..\..\..\..\..\..\Data\Wikipedia_Science.png");
  35. page.Canvas.DrawImage(image, new PointF(pageWidth - image.PhysicalDimension.Width, y));
  36. float imageLeftSpace = pageWidth - image.PhysicalDimension.Width - 2;
  37. float imageBottom = image.PhysicalDimension.Height + y;
  38.  
  39. //refenrence content
  40. PdfTrueTypeFont font3 = new PdfTrueTypeFont(new Font("Arial", 9f));
  41. PdfStringFormat format3 = new PdfStringFormat();
  42. format3.ParagraphIndent = font3.Size * 2;
  43. format3.MeasureTrailingSpaces = true;
  44. format3.LineSpacing = font3.Size * 1.5f;
  45. String text1 = "(All text and picture from ";
  46. String text2 = "Wikipedia";
  47. String text3 = ", the free encyclopedia)";
  48. page.Canvas.DrawString(text1, font3, brush2, 0, y, format3);
  49.  
  50. size = font3.MeasureString(text1, format3);
  51. float x1 = size.Width;
  52. format3.ParagraphIndent = 0;
  53. PdfTrueTypeFont font4 = new PdfTrueTypeFont(new Font("Arial", 9f, FontStyle.Underline));
  54. PdfBrush brush3 = PdfBrushes.Blue;
  55. page.Canvas.DrawString(text2, font4, brush3, x1, y, format3);
  56. size = font4.MeasureString(text2, format3);
  57. x1 = x1 + size.Width;
  58.  
  59. page.Canvas.DrawString(text3, font3, brush2, x1, y, format3);
  60. y = y + size.Height;
  61.  
  62. //content
  63. PdfStringFormat format4 = new PdfStringFormat();
  64. text = System.IO.File.ReadAllText(@"..\..\..\..\..\..\Data\Summary_of_Science.txt");
  65. PdfTrueTypeFont font5 = new PdfTrueTypeFont(new Font("Arial", 10f));
  66. format4.LineSpacing = font5.Size * 1.5f;
  67. PdfStringLayouter textLayouter = new PdfStringLayouter();
  68. float imageLeftBlockHeight = imageBottom - y;
  69. PdfStringLayoutResult result
  70. = textLayouter.Layout(text, font5, format4, new SizeF(imageLeftSpace, imageLeftBlockHeight));
  71. if (result.ActualSize.Height < imageBottom - y)
  72. {
  73. imageLeftBlockHeight = imageLeftBlockHeight + result.LineHeight;
  74. result = textLayouter.Layout(text, font5, format4, new SizeF(imageLeftSpace, imageLeftBlockHeight));
  75. }
  76. foreach (LineInfo line in result.Lines)
  77. {
  78. page.Canvas.DrawString(line.Text, font5, brush2, 0, y, format4);
  79. y = y + result.LineHeight;
  80. }
  81. PdfTextWidget textWidget = new PdfTextWidget(result.Remainder, font5, brush2);
  82. PdfTextLayout textLayout = new PdfTextLayout();
  83. textLayout.Break = PdfLayoutBreakType.FitPage;
  84. textLayout.Layout = PdfLayoutType.Paginate;
  85. RectangleF bounds = new RectangleF(new PointF(0, y), page.Canvas.ClientSize);
  86. textWidget.StringFormat = format4;
  87. textWidget.Draw(page, bounds, textLayout);
  88.  
  89. //Save pdf file.
  90. doc.SaveToFile("TextLayout.pdf");
  91. doc.Close();
  92.  
  93. //Launching the Pdf file.
  94. PDFDocumentViewer("TextLayout.pdf");
  95. }

5.XPS转换为PDF:

  1. public void XPStoPDF()
  2. {
  3. //xps file
  4. String file = @"..\..\..\..\..\..\Data\Sample4.xps";
  5.  
  6. //open xps document
  7. PdfDocument doc = new PdfDocument();
  8. doc.LoadFromXPS(file);
  9.  
  10. //convert to pdf file.
  11. doc.SaveToFile("Sample4.pdf");
  12. doc.Close();
  13.  
  14. //Launching the Pdf file.
  15. PDFDocumentViewer("Sample4.pdf");
  16. }

6.Image转换为PDF:

  1. public void ImageToPdf()
  2. {
  3. //Create a pdf document.
  4. PdfDocument doc = new PdfDocument();
  5.  
  6. // Create one page
  7. PdfPageBase page = doc.Pages.Add();
  8.  
  9. //Draw the text
  10. page.Canvas.DrawString("Hello, World!",
  11. new PdfFont(PdfFontFamily.Helvetica, 30f),
  12. new PdfSolidBrush(Color.Black),
  13. 10, 10);
  14. //Draw the image
  15. PdfImage image = PdfImage.FromFile(@"..\..\..\..\..\..\Data\SalesReportChart.png");
  16. float width = image.Width * 0.75f;
  17. float height = image.Height * 0.75f;
  18. float x = (page.Canvas.ClientSize.Width - width) / 2;
  19.  
  20. page.Canvas.DrawImage(image, x, 60, width, height);
  21.  
  22. //Save pdf file.
  23. doc.SaveToFile("Image.pdf");
  24. doc.Close();
  25.  
  26. //Launching the Pdf file.
  27. PDFDocumentViewer("Image.pdf");
  28. }

以上提供了对网站发起HTTP请求,获取网站页面信息,以及采用Spire.PDF组件创建PDF文档。如果有需要可以直接将HTTP请求获取到的信息直接加载如Spire.PDF的组件中,

由组件直接将网页信息转化为PDF文件,在这里就不再做更多的赘述,由于官方提供了很完善的demo和操作文档,在这里就不再过多的介绍使用方法。

四.总结:

以上介绍了一款收费不开源的组件,没有更多的深入的去介绍,由于组件不开源,无法进行反编译,毕竟存在版权问题,如果需要使用到企业级的文档操作组件,并且公司不缺钱的话,可以使用一下此组件,组件的底层方法封装度较高,所以在使用的时候,开发者所需要考虑的是如何去使用组件完成功能。

个人认为软件收费应该是趋势,毕竟任何软件都是需要投入,无论是人力成本,还是资金和时间成本。本文虽然是一篇介绍技术的文章,但是也提出了一个所有开发者都在想的问题,在项目开发中到底需不需要使用收费的软件,其实这个就是看使用环境。

爱知求真,静心钻研,虚心学习,务实创新,细致平和。
 
 
标签: c#Spire组件PDF

NET Office 组件Spire的更多相关文章

  1. 高效而稳定的企业级.NET Office 组件Spire(.NET组件介绍之二)

    在项目开发中,尤其是企业的业务系统中,对文档的操作是非常多的,有时几乎给人一种错觉的是”这个系统似乎就是专门操作文档的“.毕竟现在的很多办公中大都是在PC端操作文档等软件,在这些庞大而繁重的业务中,单 ...

  2. [.NET] 打造一个很简单的文档转换器 - 使用组件 Spire.Office

    打造一个很简单的文档转换器 - 使用组件 Spire.Office [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/6024827.html 序 之前,& ...

  3. Spire.Office组件使用例子

    用.NET开发程序通常要涉及到对Office文件读写操作,比较常见的操作比如提取文本,导出Excel格式数据,动态生成word文档,生成pdf文档等. 实现这些功能通常需要在服务端安装office软件 ...

  4. 推荐一套.NET文档处理组件Spire.Office

    原文:推荐一套.NET文档处理组件Spire.Office 以前的项目中用到一点Word简单处理的功能(文字替换和转PDF格式),当时使用的是一套COM组件,必须在服务器上安装office环境.最近考 ...

  5. Asp.net导出Excel续章(自定义合并单元格,非Office组件)

    结合上次写的导出Excel方法,这次上头要求我将列头进行一下合并 以前的效果: 改进后的效果: 在上篇文章中写到了Excel的导出方法,这次为了避免在生产环境中使用Office组件,服务器各种权限配置 ...

  6. 【目录】C#操作Excel组件Spire.XLS系列文章目录

    本博客所有文章分类的总目录链接:http://www.cnblogs.com/asxinyu/p/4288836.html 1.C#操作Excel组件Spire.XLS文章目录 1.[原创].NET读 ...

  7. windows 2008 下C#调用office组件访问拒绝的解决方法(failed due to the following error: 80070005 拒绝访问)

    "组件服务"- >"计算机"- >"我的电脑"- >"DCOM配置"->找到word->属 ...

  8. .NET通过调用Office组件导出Word文档

    .NET通过调用Office组件导出Word文档 最近做项目需要实现一个客户端下载word表格的功能,该功能是用户点击"下载表格",服务端将该用户的数据查询出来并生成数据到Word ...

  9. Asp.Net调用Office组件操作时的DCOM配置 (转)

    Asp.Net调用Office组件操作时的DCOM配置 http://blog.csdn.net/gz775/article/details/6447758 在项目中将数据导出为Excel格式时出现“ ...

随机推荐

  1. Android Studio用release模式进行调试

    有时候调试SDK必须要用release版本,但是每次打包混淆太麻烦,希望能在IDE中直接跑出release版本的应用,简单来说就是在debug模式下产生release版本的app,这时候该怎么做呢?当 ...

  2. 【原】自定义UINavigationItem的两种方法以及相应的隐藏方法

    第一种: UIImage *searchimage=[UIImage imageNamed:@"search.png"]; UIBarButtonItem *barbtn=[[[U ...

  3. iOS-协议与代理<转>

    代理,又称委托代理(delegate),是iOS中常用的设计一种模式.顾名思义,它是把某个对象要做的事情委托给别的对象去做.那么别的对象就是这个对象的代理,代替它来打理要做的事.反映到程序中, 首先要 ...

  4. 如何写BaseDomain

    上图摘自<Spring3.x企业应用开发实战> 提到了使用org.apache.commons.lang3.builder ToStringBuilder进行toString方法的统一. ...

  5. 阶乘 求n!中质因数的个数

    在n!中末尾有几个0 取决于n!中5的个数(2肯定比5多) 所以遍历从1到n的数,看总共有几个5即可 ..N do j = i; == ) ++ret; j /= ; end end 有个nb的方法: ...

  6. 【转载】主数据管理(MDM)与元数据管理

    主数据(Master Data)和元数据(Meta Data)是两个完全不同的概念.元数据是指表示数据的相关信息,比如数据定义等,而主数据是指实例数据,比如产品目录信息等.比如,某省地税开发了一套 征 ...

  7. Effective Java 54 Use native methods judiciously

    Java Native Interface(JNI) allows Java applications to call native methods, which are special method ...

  8. MongoDB学习笔记——数据库安装及配置

    MongoDB数据库安装 MongoDB官方下载地址:https://www.mongodb.com/download-center 首先需要根据Windows版本选择正确的MongoDB版本进行安装 ...

  9. 微信开发(03)之新建按钮时报错 errcode 40054

    在微信开发新建公众号的按钮时,报错如下: {errcode:40054,errmsg:"invalid sub button url domain"} 经过仔细排查,发现是url地 ...

  10. C#程序员开发WinForm必须知道的 Window 消息大全(转)

    消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变窗口尺寸.按下键盘上的一个键都会使Windows发送一个消息给应用程序.  消息本身是作为一个记录传递给应用程 ...