本文介绍了基于Word文档生成PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个带有数千个数据项的数据库(SQL Server)(每个项目都是一个带有所有信息的实习生)和预定义的单词文档作为模板,要求是 - 对于每个受训者 - (谁的登录),将相应的数据(实习生信息)填入模板字段,以及生成一个只读PDF文件。 平台是ASP.NET(C#)。 我找到了两个解决方案: 1.将word文档更改为PDF格式,并使用iTextSharp填写表单字段。但是,创建具有正确格式(字体,布局等)的PDF表单是一项艰巨的工作,当系统用户想要添加新模板时,它需要特定的工具和新技能(除非PDF表单总是由开发人员创建)。 br /> 2.在word文件中添加文本占位符,程序可以读取word文件,替换文本,然后转换为PDF。但我不知道如何继续。解决方案 或者,你可以在Word中完成整个事情。您所描述的内容称为邮件合并,您可以将整个文档打印到PDF打印机,而无需一行代码。 您可以查看以下文章: http://social.msdn.microsoft.com/Forums/office/en-US/40b2ee36-13c9-420d-a6b5-3ec5f42b09d7/converting-docx-to-pdf [ ^ Hi,I have a database(SQL Server) with thousands data items(each item is a trainee with all his informations), and a predefined word document as template, the requirement is - for each trainee- (Who's loggedon), fill corresponding data(trainee informations) into template fields, and generate a readonly PDF file as result.Platform is ASP.NET(C#).I found two solutions: 1. Change the word document into a PDF form, and use iTextSharp to fill the form fields. But create the PDF form with correct format (font, layout, etc.) is a difficult work, and it needs particular tool and new skill when system user wants to add new template (unless the PDF form is always created by developer). 2. Add text placeholder in the word file, and the program can read word file, replace text, and convert into PDF. but i don't know how to proceed. 解决方案 Or, you could just do the entire thing in Word. What you're describing is called "Mail Merge" and you can print the entire document to a PDF "printer" without a single line of code.You can check on this article:http://social.msdn.microsoft.com/Forums/office/en-US/40b2ee36-13c9-420d-a6b5-3ec5f42b09d7/converting-docx-to-pdf[^] 这篇关于基于Word文档生成PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 07:42