1.先在网上下载itextsharp.dll,然后引用到工程里。
以下是导出PDF的代码部分,仅供参考
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Web;
using System.Drawing;
using Font = iTextSharp.text.Font;
namespace YC300.Export
{
public class ExportToPDF
{
public void OutputAsPdfFile(DataGridView dataGridView_result)
{
Boolean cc = false;
string strFileName;
///设置导出字体
string path = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
string FontPath = path + "\\simsun.ttc";
int FontSize = 12;
if (File.Exists(FontPath))
{
FontPath += ",1";
}
else
{