【发布时间】:2020-10-14 06:31:31
【问题描述】:
下面是我用来从数据库中获取所需数据的代码,我使用断点检查过它,并且 userName 确实包含数据。
var userName = db.M_User.Where(x => x.UserID == userId).Select(x => x.Full_name).FirstOrDefault();
我尝试使用下面的代码显示它
document.Add(new Paragraph("I, "+userName)
I 被打印出来,除了 userName
我已经在视图中有表单,这些代码仅用于打印 pdf
【问题讨论】:
-
如果
userName恰好由非拉丁字母组成,您可能必须使用可以对其进行编码的字体。 -
@mkl
userName没有任何非拉丁字母,它只包含一个像'Steven'这样的名字,就是这样
标签: c# .net asp.net-mvc pdf itext