如何在C#中从数据库生成pdf [英] How to generate pdf in C# from database

查看:168
本文介绍了如何在C#中从数据库生成pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为租赁管理创建一个c#项目。我需要程序的功能从数据库中读取并生成带有来自数据库的信息的要约信。来自数据库的信息将是姓名,姓氏,房屋类型和您支付的金额。字母应该是相同的,只有我想要的功能是将信息插入所需部分并生成录取通知书



我尝试过:



我做了数据库的一部分剩下的就是向我展示如何用c#中的数据库生成的东西写一个pdf的示例#div class =h2_lin>解决方案

我假设您正在使用一个模板,您可以将其存储在字符串构建器中。

所以您需要做的是string.format并在模板中从数据库中获取信息可以作为参数给出,以读取像String.format(名称:{0},名称)之类的东西。



一旦你得到了所有东西,那么你可以使用一些pdf库用这个信息创建一个pdf。

I want to create a c# project for rental management. I need the functionality of the program to read from a database and generate an offer letter with information from database..information from database will be name ,last name ,house type and amount you paying.The letter should be same only functionality I want is for it to slot the information in required sections and generate an offer letter

What I have tried:

I did database part of it what am left with is just to show me a sample of how to write to a pdf with stuff generated from a database in c#

解决方案

I assume, you are using a template which you can store it in String builder.
So what you need to do is string.format and in your template the information from database can be given as parameter to read something like String.format("Name:{0}", name).

Once you got everything, then you can use some pdf libraries to create a pdf with that information.


这篇关于如何在C#中从数据库生成pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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