合并与Word或PDF文档SQL Server数据的最佳方式 [英] Best way to merge sql server data with Word or PDF document

查看:232
本文介绍了合并与Word或PDF文档SQL Server数据的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要写vb.net code在我的asp.net网站填写使用从SQL Server数据库的数据形式。形式可以是pre-现有的Word文档或PDF。在合并后,然后根据需要,用户可调节的输入等...

这是我应该如何去这有什么建议?有人提到一些关于利用开放的XML,但我不知道,如果:


  1. 这是最好的建议

  2. 从哪里开始/如何去做。


解决方案

要明确这一点,这是一个大的话题,什么我仍然工作在全面实施自己为好。我将开始与自己使用开放XML的想法。

对于Word,这不是一个坏主意,虽然你不会使用的Open XML,而是微软格式的XML文档。我结合具体使用该用Response.ContentType命令来创建动态的多页Excel表。我还没有尝试过的单词,但你会怎么做,这是创建一个类似于要在词什么文档,并将其保存为XML文档而不是文档或DOCX。然后,打开该文件,并用它来反向工程是该格式创建页面。

明白不过,由于Response.ContentType行为只能在IE中最好的,这仅仅是在Intranet类型设置逼真的XML文件将不会因为默认情况下word文档打开。这是可能的,但不建议使用。

您也可以组合使用XML使用VBA脚本,以创建Word文档虽然这不是一个真正的通用或推荐的方式无论是。

最常用的方法是使用.NET的办公库生成的Word文档。你将不得不谷歌自己如何使用它,因为这是一个广泛的话题。

在PDF结束选项是多一点稀疏。您的要求编辑限制你一些工具。

创建文档并保存在服务器上是指与Word文档描述,你基本上可以做同样的程序。这里的问题是,你需要Adobe Acrobat Pro或类似的产品生成文档和专业执照通常是不便宜。

更多的人通常只使用两种或PDFSharp iTextSharp的用于此目的,但。 iTextSharp的是更强大的程序,允许用于数字签名和所有有趣的东西。 iTextSharp的需要,其中code是不是开源的,虽然所有项目的许可证。另一方面PDFSharp是免费的,但不具有同样多的特点。如果你想要做数字签名有了它,你就需要做一些像这里描述的添加数字签名到PDF文件

I need to write vb.net code in my asp.net website to fill in forms using data from a sql server db. The form can be a pre-existing Word document or a PDF. After the merge then the user can adjust the inputs as needed, etc…

Any suggestions on how I should go about this? Someone mentioned something about utilizing Open XML but I have no clue if:

  1. It's the best suggestion
  2. Where to start/how to go about it.

解决方案

To make this clear this is a large topic, and something I am still working on fully implementing myself as well. I will start with your own idea of using "Open XML".

For Word this is not a bad idea although you will not be using open xml but rather an xml document in Microsoft's format. I specifically use this in conjunction with the Response.ContentType command to create dynamic multi-page excel sheets. I have not tried it in word but how you would do this is create a document similar to what you want in word and save it as an XML document instead of a doc or docx. You then open that document and use it to reverse engineer it creating a page in that format.

Understand though that this is only realistic on an intranet type setting as Response.ContentType behaves best only in IE and the xml files will not open as word documents by default. it is possible but not recommended.

You can also use XML in combination with VBA scripts in order to create the word document although this is not really a common or recommended way either.

The most common way is to generate the word document using .net's library for Office. You will have to google yourself how to use it as that is an extensive topic.

On the PDF end the options are a little more sparse. Your requirement for editing limits you to a few tools.

Creating the document and saving it on the server means you can essentially do the same procedure as described with the word document. The problem here is you require Adobe Acrobat Pro or a similar product to generate the document and a Pro licence is usually not cheap.

More people usually just use either PDFSharp or ITextSharp for this purpose though. ITextSharp is the much more robust program that allows for digital signatures and all that fun stuff. ITextSharp requires a licence for all projects where the code is not open source though. PDFSharp on the other hand is free but does not have as much features. If you wanted to do digital signatures with it you would need to do something like described here Adding a digital signature to a pdf file.

这篇关于合并与Word或PDF文档SQL Server数据的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆