Tag: header

PdfPTable作为iTextSharp中的标题

我需要一个包含大约12个单元格的表格作为标题显示。 以下代码无法执行此操作。 我知道table2没有12个单元格。 在第二页上,仅显示“测试”。 我错过了什么? 提前致谢! Document document = new Document(); try { PdfWriter.GetInstance(document, new FileStream(“TableTest.pdf”, FileMode.Create)); document.Open(); PdfPTable table = new PdfPTable(1); table.WidthPercentage = 100; PdfPTable table2 = new PdfPTable(2); //logo PdfPCell cell2 = new PdfPCell(Image.GetInstance(@”C:\path\to\file.gif”)); cell2.Colspan = 2; table2.AddCell(cell2); //title cell2 = new PdfPCell(new Phrase(“\nTITLE TEXT”, new Font(Font.HELVETICA, 16, Font.BOLD | Font.UNDERLINE))); cell2.HorizontalAlignment […]

在ASP.NET上创建JSON标头

我正在将脚本从PHP转换为ASP.net C#。 在PHP中,我可以使用类似的东西: header(’Content-type:text / json’); header(’Content-type:application / json’); 如何告诉我的aspx页面在标题中声明它正在打印JSON文件?

DataGridView覆盖顶部,左侧标题单元格单击(全选)

我想覆盖DataGridView标题/列单元格(顶部,左侧单元格)中鼠标单击的行为。 该单元格会导致选择所有行。 相反,我想阻止它选择所有行。 我看到一个RowHeaderSelect和ColumnHeaderSelect的事件,但没有一个针对该顶部左侧标题单元格的事件。 有任何想法吗? 我只是在失明吗?

使用OpenXML SDK 2.0将页眉和页脚添加到现有的空单词文档中

我正在尝试在空文档中添加页眉和页脚。 当将docx更改为zip时,我使用此代码在word / document.xml中添加Header部分。 ApplyHeader(doc); public static void ApplyHeader(WordprocessingDocument doc) { // Get the main document part. MainDocumentPart mainDocPart = doc.MainDocumentPart; // Delete the existing header parts. mainDocPart.DeleteParts(mainDocPart.HeaderParts); // Create a new header part and get its relationship id. HeaderPart newHeaderPart = mainDocPart.AddNewPart(); string rId = mainDocPart.GetIdOfPart(newHeaderPart); // Call the GeneratePageHeaderPart helper method, passing in […]

如何在WCF中向请求添加授权标头?

我正在使用Windows窗体应用程序,并且需要调用WCF服务。 我需要在请求发送到服务之前向请求添加标头(授权 – 自定义)。 我也有一个自定义检查器类。 我尝试了以下但是服务没有被调用,不知何故,它返回一个exception。 public object BeforeSendRequest(ref Message request, IClientChannel channel) { MessageHeader header = MessageHeader.CreateHeader(“Authorization”, “”, “Basic Y19udGk6Q29udGlfQjNTVA==”); OperationContext.Current.OutgoingMessageHeaders.Add(header); HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers.Add(“Authorization”, “Basic Y19udGk6Q29udGlfQjNTVA==”); httpRequestProperty.Headers.Add(HttpRequestHeader.UserAgent, “Continental”); OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; sentMessages.Add(request.ToString()); return null; } 我也尝试过这样一个最简单的方法: MessageHeader header = MessageHeader.CreateHeader(“Authorization”, “”, “Basic Y19udGk6Q29udGlfQjNTVA==”); request.Headers.Add(header); 但它是相同的,添加了授权标题,但它没有到达服务,我怎么知道服务接收到什么标题? 当我在请求中手动添加这样的头文件(运行之前)时,我使用SOAP UI和服务响应很好。

将C ++ .lib和.h文件导入C#项目?

我刚刚启动了一个C#项目,想要导入一个C ++ .lib和它相应的头文件(.h)。 我读过各种post都提到.dll,而不是.lib,这让我感到困惑。 下图显示了我所指的.lib和.h文件,我所做的就是将它们拖入项目中。 任何人都能指出我更清楚地解释如何去做这件事吗? 我敢肯定它不会像看起来那么难。

如果我在c#中发送0个有效载荷数据,udp数据包的大小是多少?

我已经找出了使用udp的2个端点之间的碎片之前的最大数据是1472(其他端点可能不同)。 这表明mtu是1500字节,每个数据包的头开销是28bytes。可以安全地假设如果我发送0字节数据(有效载荷),传输的实际数据是28字节? 我正在做一些bencchmark,所以对我来说知道频道中发生了什么至关重要。 谢谢。

检测PDF文件是否正确(标题PDF)

我有一个Windows应用程序.NET管理许多PDF文件。 有些文件已损坏。 2个问题:我会用最糟糕的英语解释…对不起 1.) 如何检测pdf文件是否正确? 我想读PDF的标题和检测是正确的。 var okPDF = PDFCorrect(@“C:\ temp \ pdfile1.pdf”); 2.) 如何知道文件的byte [](bytearray)是否是PDF文件。 例如,对于ZIP文件,您可以检查前四个字节并查看它们是否与本地标头签名匹配,即以hex表示 50 4b 03 04 if(buffer [0] == 0x50 && buffer [1] == 0x4b && buffer [2] == 0x03 && buffer [3] == 0x04) 如果要将其加载到long中,则为(0x04034b50)。 作者:David Pierson 我希望PDF文件也一样。 byte [] dataPDF = … var okPDF = PDFCorrect(dataPDF); .NET中的任何示例源代码?