Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将数据从C导出为PDF时出错#_C#_Asp.net - Fatal编程技术网

C# 将数据从C导出为PDF时出错#

C# 将数据从C导出为PDF时出错#,c#,asp.net,C#,Asp.net,我正在用C#编写一个PDF文件,如下所示: Response.ContentType = "application/vnd.pdf"; Response.AddHeader("content-disposition", "attachment;filename=test.pdf"); Response.Write("<table border='1px'>"); /* Print Headers */ Response.Write("<tr>"); Response.W

我正在用C#编写一个PDF文件,如下所示:

Response.ContentType = "application/vnd.pdf";
Response.AddHeader("content-disposition", "attachment;filename=test.pdf");
Response.Write("<table border='1px'>");

/* Print Headers */
Response.Write("<tr>");
Response.Write("<th colspan='" + colspan + "'style='background-color:SlateGray;font-size:16;height:25;color:white;'><b>List of Candidates  "</b></th>");
Response.Write("</tr>");
Response.Write("<tr>");
Response.ContentType=“application/vnd.pdf”;
AddHeader(“内容处置”、“附件;文件名=test.pdf”);
回答。写(“”);
/*打印标题*/
回答。写(“”);
答复。填写(“候选人名单”);
回答。写(“”);
回答。写(“”);

当我保存并打开文件时,它会抛出一个异常,即文件不受支持的文件类型..或文件已损坏。

要创建pdf表单html,您应该查看它

要使用itextsharp创建表,请看一看


您正在编写tr、td,并希望将其导出为pdf格式?这是不可能的。您应该尝试查看iTextSharp。