@@ -0,0 +1,891 @@ | ||
1 | +Imports System | |
2 | +Imports System.IO | |
3 | +Imports System.Linq | |
4 | +Imports System.Linq.Expressions | |
5 | +Imports System.Collections.Generic | |
6 | +Imports System.Data | |
7 | +Imports System.Data.SqlClient | |
8 | +Imports System.Data.Common | |
9 | +Imports System.Globalization | |
10 | +Imports Microsoft.VisualBasic | |
11 | +Imports Infragistics.Documents.Reports.Report | |
12 | +Imports Infragistics.Documents.Reports.Graphics | |
13 | +Imports Infragistics.Documents.Reports.Report.Section | |
14 | +Imports Infragistics.Documents.Reports.Report.Text | |
15 | +Imports Infragistics.Documents.Reports.Report.Grid | |
16 | +Imports System.ComponentModel | |
17 | + | |
18 | +Public Class RptPDF00 | |
19 | + | |
20 | +#Region "定数定義" | |
21 | + | |
22 | + Protected Shared ReadOnly iPadding As Integer = 3 | |
23 | + Protected Shared fontDef As Style = Nothing | |
24 | + Protected Shared BorderBS As New Border(New Pen(Colors.Black, DashStyle.Solid)) | |
25 | + Protected Shared BorderBD As New Border(New Pen(Colors.Black, DashStyle.Dot)) | |
26 | + | |
27 | + | |
28 | + Protected Shared Function CreateFont(ByVal fontSize As Single) As System.Drawing.Font | |
29 | + | |
30 | + Dim fontFilePath As String = System.Web.HttpContext.Current.Server.MapPath("~") & "\files\msgothic.ttc" | |
31 | + Dim pfc As New System.Drawing.Text.PrivateFontCollection | |
32 | + pfc.AddFontFile(fontFilePath) | |
33 | + CreateFont = New System.Drawing.Font(pfc.Families(0), fontSize) | |
34 | + | |
35 | + End Function | |
36 | + | |
37 | + Protected Shared Function CreateStyle(ByVal fontSize As Integer, brushesColor As Brush) As Style | |
38 | + CreateStyle = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
39 | + CreateFont(fontSize)), brushesColor) | |
40 | + End Function | |
41 | + | |
42 | + Public Shared Function sNULLPDF(ByVal DBValue As Object) As String | |
43 | + | |
44 | + sNULLPDF = " " | |
45 | + | |
46 | + If Not DBValue Is DBNull.Value Then | |
47 | + sNULLPDF = DBValue | |
48 | + End If | |
49 | + | |
50 | + End Function | |
51 | + | |
52 | + Public Shared Function dNULLPDF(ByVal DBValue As Object) As String | |
53 | + | |
54 | + dNULLPDF = " " | |
55 | + | |
56 | + If Not DBValue Is DBNull.Value Then | |
57 | + dNULLPDF = CDec(DBValue).ToString() | |
58 | + | |
59 | + End If | |
60 | + | |
61 | + End Function | |
62 | + | |
63 | + Public Shared Function dNULL(ByVal DBValue As Object) As Decimal | |
64 | + dNULL = 0 | |
65 | + If Not DBValue Is DBNull.Value Then | |
66 | + dNULL = CDec(DBValue) | |
67 | + End If | |
68 | + End Function | |
69 | + | |
70 | + Public Shared Function sFileName(ByVal sName As String) As String | |
71 | + | |
72 | + sFileName = System.Web.HttpUtility.UrlEncode(sName) | |
73 | + Dim sBrowser As String = System.Web.HttpContext.Current.Request.Browser.Browser.ToUpper() | |
74 | + If sBrowser = "FIREFOX" Then | |
75 | + sFileName = Chr(34) & sName & Chr(34) | |
76 | + End If | |
77 | + | |
78 | + End Function | |
79 | + | |
80 | + | |
81 | +#End Region | |
82 | + | |
83 | +#Region "GROUP SYTLE 定義" | |
84 | + | |
85 | + Public Shared Sub iGroup_U1D1(ByRef iCell As IGridCell, ByVal unitHeight As Integer, | |
86 | + ByVal arryValue() As String, | |
87 | + ByVal arryAlignment() As Alignment, | |
88 | + ByVal arryBorders() As Boolean) | |
89 | + | |
90 | + Dim iText As IText = Nothing | |
91 | + | |
92 | + Dim iGroup_CNT As IGroup = iCell.AddGroup() | |
93 | + iGroup_CNT.Layout = Layout.Vertical | |
94 | + iGroup_CNT.Height = New FixedHeight(unitHeight * 2) | |
95 | + | |
96 | + Dim iGroupUnit As IGroup = iGroup_CNT.AddGroup() | |
97 | + If arryBorders(0) Then | |
98 | + iGroupUnit.Borders.Bottom = BorderBS | |
99 | + End If | |
100 | + | |
101 | + iGroupUnit.Layout = Layout.Horizontal | |
102 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
103 | + iGroupUnit.Alignment.Vertical = Alignment.Middle | |
104 | + iGroupUnit.Height = New FixedHeight(unitHeight) | |
105 | + iGroupUnit.Width = New RelativeWidth(100) | |
106 | + GroupAddText(iGroupUnit, arryValue(0), arryAlignment(0), fontDef) | |
107 | + | |
108 | + iGroupUnit = iGroup_CNT.AddGroup() | |
109 | + iGroupUnit.Layout = Layout.Horizontal | |
110 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
111 | + iGroupUnit.Alignment.Vertical = Alignment.Middle | |
112 | + iGroupUnit.Height = New FixedHeight(unitHeight) | |
113 | + iGroupUnit.Width = New RelativeWidth(100) | |
114 | + | |
115 | + GroupAddText(iGroupUnit, arryValue(1), arryAlignment(1), fontDef) | |
116 | + | |
117 | + | |
118 | + End Sub | |
119 | + | |
120 | + Public Shared Sub iGroup_U1D2(ByRef iCell As IGridCell, ByVal unitHeight As Integer, | |
121 | + ByVal arryValue() As String, | |
122 | + ByVal arryAlignment() As Alignment, | |
123 | + ByVal arryBorders() As Boolean, | |
124 | + ByVal arryRelativeWidth() As Integer) | |
125 | + | |
126 | + Dim iText As IText = Nothing | |
127 | + | |
128 | + Dim iGroup_U1D3 As IGroup = iCell.AddGroup() | |
129 | + iGroup_U1D3.Layout = Layout.Vertical | |
130 | + iGroup_U1D3.Height = New FixedHeight(unitHeight * 2) | |
131 | + | |
132 | + | |
133 | + Dim iGroupUp As IGroup = iGroup_U1D3.AddGroup() | |
134 | + If arryBorders(0) Then | |
135 | + iGroupUp.Borders.Bottom = BorderBS | |
136 | + End If | |
137 | + | |
138 | + iGroupUp.Layout = Layout.Horizontal | |
139 | + iGroupUp.Alignment.Horizontal = Alignment.Center | |
140 | + iGroupUp.Alignment.Vertical = Alignment.Middle | |
141 | + iGroupUp.Height = New FixedHeight(unitHeight) | |
142 | + iGroupUp.Width = New RelativeWidth(100) | |
143 | + iText = iGroupUp.AddText() | |
144 | + iText.AddContent(arryValue(0), fontDef) | |
145 | + iText.Alignment.Horizontal = arryAlignment(0) | |
146 | + | |
147 | + | |
148 | + | |
149 | + | |
150 | + Dim iGroupDown As IGroup = iGroup_U1D3.AddGroup() | |
151 | + iGroupDown.Alignment.Horizontal = Alignment.Center | |
152 | + iGroupDown.Alignment.Vertical = Alignment.Middle | |
153 | + iGroupDown.Height = New FixedHeight(unitHeight) | |
154 | + iGroupDown.Width = New RelativeWidth(100) | |
155 | + iGroupDown.Layout = Layout.Horizontal | |
156 | + | |
157 | + | |
158 | + Dim iGroupDownUnit1 As IGroup = iGroupDown.AddGroup() | |
159 | + If arryBorders(1) Then | |
160 | + iGroupDownUnit1.Borders.Right = BorderBS | |
161 | + End If | |
162 | + | |
163 | + iGroupDownUnit1.Height = New FixedHeight(unitHeight) | |
164 | + iGroupDownUnit1.Width = New RelativeWidth(arryRelativeWidth(0)) | |
165 | + iGroupDownUnit1.Alignment.Horizontal = Alignment.Center | |
166 | + iGroupDownUnit1.Alignment.Vertical = Alignment.Middle | |
167 | + | |
168 | + | |
169 | + GroupAddText(iGroupDownUnit1, arryValue(1), arryAlignment(1), fontDef) | |
170 | + | |
171 | + | |
172 | + | |
173 | + | |
174 | + Dim iGroupDownUnit2 As IGroup = iGroupDown.AddGroup() | |
175 | + iGroupDownUnit2.Height = New FixedHeight(unitHeight) | |
176 | + iGroupDownUnit2.Width = New RelativeWidth(arryRelativeWidth(1)) | |
177 | + iGroupDownUnit2.Alignment.Horizontal = Alignment.Center | |
178 | + iGroupDownUnit2.Alignment.Vertical = Alignment.Middle | |
179 | + | |
180 | + GroupAddText(iGroupDownUnit2, arryValue(2), arryAlignment(2), fontDef) | |
181 | + | |
182 | + End Sub | |
183 | + | |
184 | + Public Shared Sub iGroup_Horizontal(ByRef iCell As IGridCell, ByVal unitHeight As Integer, | |
185 | + ByVal arryValue() As String, | |
186 | + ByVal arryAlignment() As Alignment, | |
187 | + ByVal arryBorders() As Boolean, | |
188 | + ByVal arryWidth() As Integer) | |
189 | + | |
190 | + Dim iText As IText = Nothing | |
191 | + Dim iGroup_CTN As IGroup = iCell.AddGroup() | |
192 | + iGroup_CTN.Layout = Layout.Horizontal | |
193 | + iGroup_CTN.Height = New FixedHeight(unitHeight) | |
194 | + iGroup_CTN.Width = New RelativeWidth(100) | |
195 | + | |
196 | + For iCtr As Integer = 0 To arryValue.Count - 1 | |
197 | + | |
198 | + Dim iGroupUnit As IGroup = iGroup_CTN.AddGroup() | |
199 | + iGroupUnit.Height = New FixedHeight(unitHeight) | |
200 | + iGroupUnit.Width = New RelativeWidth(arryWidth(iCtr)) | |
201 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
202 | + iGroupUnit.Alignment.Vertical = Alignment.Middle | |
203 | + | |
204 | + If arryBorders(iCtr) Then | |
205 | + iGroupUnit.Borders.Right = BorderBS | |
206 | + End If | |
207 | + | |
208 | + GroupAddText(iGroupUnit, arryValue(iCtr), arryAlignment(iCtr), fontDef) | |
209 | + | |
210 | + Next | |
211 | + | |
212 | + End Sub | |
213 | + | |
214 | + Public Shared Sub iGroup_Vertical(ByRef iCell As IGridCell, ByVal unitHeight As Integer, | |
215 | + ByVal arryValue() As String, | |
216 | + ByVal arryAlignment() As Alignment, | |
217 | + ByVal arryBorders() As Boolean, | |
218 | + ByVal arryHeight() As Integer) | |
219 | + | |
220 | + Dim iText As IText = Nothing | |
221 | + Dim iGroup_CTN As IGroup = iCell.AddGroup() | |
222 | + iGroup_CTN.Layout = Layout.Vertical | |
223 | + iGroup_CTN.Height = New FixedHeight(unitHeight) | |
224 | + iGroup_CTN.Width = New RelativeWidth(100) | |
225 | + | |
226 | + For iCtr As Integer = 0 To arryValue.Count - 1 | |
227 | + | |
228 | + Dim iGroupUnit As IGroup = iGroup_CTN.AddGroup() | |
229 | + iGroupUnit.Height = New RelativeHeight(arryHeight(iCtr)) | |
230 | + iGroupUnit.Width = New RelativeWidth(100) | |
231 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
232 | + iGroupUnit.Alignment.Vertical = Alignment.Middle | |
233 | + | |
234 | + If arryBorders(iCtr) Then | |
235 | + iGroupUnit.Borders.Bottom = BorderBS | |
236 | + End If | |
237 | + | |
238 | + GroupAddText(iGroupUnit, arryValue(iCtr), arryAlignment(iCtr), fontDef) | |
239 | + | |
240 | + Next | |
241 | + | |
242 | + End Sub | |
243 | + | |
244 | + | |
245 | + | |
246 | + Public Shared Sub iGroup_U1D1_6_4(ByRef iCell As IGridCell, ByVal unitHeight As Integer, | |
247 | + ByVal arryValue() As String, | |
248 | + ByVal arryAlignment() As Alignment, | |
249 | + ByVal arryBorders() As Boolean) | |
250 | + | |
251 | + Dim iText As IText = Nothing | |
252 | + | |
253 | + Dim iGroup_CNT As IGroup = iCell.AddGroup() | |
254 | + iGroup_CNT.Layout = Layout.Vertical | |
255 | + iGroup_CNT.Height = New FixedHeight(unitHeight * 2 + 10) | |
256 | + | |
257 | + Dim iGroupUnit As IGroup = iGroup_CNT.AddGroup() | |
258 | + If arryBorders(0) Then | |
259 | + iGroupUnit.Borders.Bottom = BorderBS | |
260 | + End If | |
261 | + | |
262 | + iGroupUnit.Layout = Layout.Horizontal | |
263 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
264 | + iGroupUnit.Height = New FixedHeight(unitHeight + 13) | |
265 | + iGroupUnit.Width = New RelativeWidth(100) | |
266 | + GroupAddText(iGroupUnit, arryValue(0), arryAlignment(0), fontDef) | |
267 | + iGroupUnit.Alignment.Vertical = Alignment.Bottom | |
268 | + | |
269 | + 'iText = iGroupUnit.AddText() | |
270 | + 'iText.AddContent(arryValue(0), fontDef) | |
271 | + 'iText.Alignment.Horizontal = Alignment.Left | |
272 | + 'iText.Paddings.Left = iPadding | |
273 | + | |
274 | + | |
275 | + | |
276 | + iGroupUnit = iGroup_CNT.AddGroup() | |
277 | + iGroupUnit.Layout = Layout.Horizontal | |
278 | + iGroupUnit.Alignment.Horizontal = Alignment.Center | |
279 | + iGroupUnit.Alignment.Vertical = Alignment.Top | |
280 | + iGroupUnit.Height = New FixedHeight(unitHeight - 3) | |
281 | + iGroupUnit.Width = New RelativeWidth(100) | |
282 | + | |
283 | + GroupAddText(iGroupUnit, arryValue(1), arryAlignment(1), fontDef) | |
284 | + | |
285 | + | |
286 | + End Sub | |
287 | + | |
288 | + | |
289 | +#End Region | |
290 | + | |
291 | +#Region "AddText 専用" | |
292 | + | |
293 | + Public Shared Sub CellAddText(ByRef iCell As IGridCell, | |
294 | + ByVal txtValue As Object, | |
295 | + ByVal txtAlignment As Alignment, | |
296 | + ByVal txtFont As Style) | |
297 | + | |
298 | + Dim iText As IText = Nothing | |
299 | + | |
300 | + Dim sValue As String = sNULLPDF(txtValue) | |
301 | + iCell.Alignment.Vertical = Alignment.Middle | |
302 | + | |
303 | + Dim listValue As List(Of String) = sValue.Split(";").ToList() | |
304 | + | |
305 | + For Each unitValue As String In listValue | |
306 | + | |
307 | + iText = iCell.AddText() | |
308 | + iText.AddContent(unitValue, txtFont) | |
309 | + iText.Alignment.Horizontal = txtAlignment | |
310 | + | |
311 | + If txtAlignment = Alignment.Left Then | |
312 | + iText.Paddings.Left = iPadding | |
313 | + End If | |
314 | + | |
315 | + If txtAlignment = Alignment.Right Then | |
316 | + iText.Paddings.Right = iPadding | |
317 | + End If | |
318 | + | |
319 | + Next | |
320 | + | |
321 | + End Sub | |
322 | + | |
323 | + Public Shared Sub GroupAddText(ByRef iGroup As IGroup, | |
324 | + ByVal txtValue As Object, | |
325 | + ByVal txtAlignment As Alignment, | |
326 | + ByVal txtFont As Style) | |
327 | + | |
328 | + Dim iText As IText = Nothing | |
329 | + Dim sValue As String = sNULLPDF(txtValue) | |
330 | + | |
331 | + | |
332 | + iGroup.Alignment.Vertical = Alignment.Middle | |
333 | + | |
334 | + | |
335 | + Dim listValue As List(Of String) = sValue.Split(";").ToList() | |
336 | + | |
337 | + For Each unitValue As String In listValue | |
338 | + | |
339 | + iText = iGroup.AddText() | |
340 | + iText.AddContent(unitValue, txtFont) | |
341 | + iText.Alignment.Horizontal = txtAlignment | |
342 | + | |
343 | + If txtAlignment = Alignment.Left Then | |
344 | + iText.Paddings.Left = iPadding | |
345 | + End If | |
346 | + | |
347 | + If txtAlignment = Alignment.Right Then | |
348 | + iText.Paddings.Right = iPadding | |
349 | + End If | |
350 | + | |
351 | + Next | |
352 | + | |
353 | + End Sub | |
354 | + | |
355 | +#End Region | |
356 | + | |
357 | + | |
358 | + Public Shared Sub CreatPDF_PC() | |
359 | + | |
360 | + | |
361 | + Dim iRowHeight As Integer = 18 | |
362 | + fontDef = CreateStyle(10, Brushes.Black) | |
363 | + | |
364 | + | |
365 | + Dim iRow As IGridRow = Nothing | |
366 | + Dim iCell As IGridCell = Nothing | |
367 | + Dim iGroup As IGroup = Nothing | |
368 | + Dim iText As IText = Nothing | |
369 | + | |
370 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
371 | + CreateFont(14)), Brushes.Black) | |
372 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
373 | + CreateFont(18)), Brushes.Black) | |
374 | + | |
375 | + 'レポートを作成 | |
376 | + Dim rPDF As Report = New Report | |
377 | + | |
378 | + | |
379 | + Dim iSect As ISection = rPDF.AddSection() | |
380 | + 'ページを作成 | |
381 | + iSect.PageSize = PageSizes.A4 | |
382 | + iSect.PageOrientation = PageOrientation.Portrait | |
383 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
384 | + | |
385 | + | |
386 | + | |
387 | + 'ヘッダーを作成します | |
388 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
389 | + sectHeader.Repeat = True | |
390 | + sectHeader.Height = 110 | |
391 | + | |
392 | + | |
393 | + '要素の最初のセットを配置するためにグリッドを使用します | |
394 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
395 | + | |
396 | + | |
397 | + | |
398 | + 'グリッド要素に つの列を追加します | |
399 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
400 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
401 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
402 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
403 | + | |
404 | + iRow = iHdrGrid.AddRow() | |
405 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
406 | + iCell = iRow.AddCell() | |
407 | + iCell.ColSpan = 2 | |
408 | + iCell.Borders.All = BorderBS | |
409 | + CellAddText(iCell, "TEST PDF ", Alignment.Center, fontOther2) | |
410 | + | |
411 | + | |
412 | + | |
413 | + | |
414 | + | |
415 | + | |
416 | + Dim PDFName As String = sFileName("TEST PDF_" & Date.Now.ToString("yyyyMMdd") & ".pdf") | |
417 | + | |
418 | + | |
419 | + | |
420 | + | |
421 | + HttpContext.Current.Response.ClearHeaders() | |
422 | + HttpContext.Current.Response.Clear() | |
423 | + HttpContext.Current.Response.ContentType = "application/octet-stream" | |
424 | + HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Claim_Report_" + PDFName + ".pdf")) | |
425 | + | |
426 | + System.Web.HttpContext.Current.Response.Flush() | |
427 | + rPDF.Publish(System.Web.HttpContext.Current.Response.OutputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
428 | + System.Web.HttpContext.Current.Response.Flush() | |
429 | + HttpContext.Current.ApplicationInstance.CompleteRequest() | |
430 | + | |
431 | + | |
432 | + | |
433 | + | |
434 | + 'HttpContext.Current.Response.Buffer = True | |
435 | + 'System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + PDFName) | |
436 | + 'System.Web.HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary") | |
437 | + 'System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream" | |
438 | + | |
439 | + | |
440 | + | |
441 | + 'System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=" + PDFName) | |
442 | + 'System.Web.HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary") | |
443 | + ''System.Web.HttpContext.Current.Response.ContentType = "application/pdf" | |
444 | + 'rPDF.Publish(System.Web.HttpContext.Current.Response.OutputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
445 | + 'System.Web.HttpContext.Current.Response.Flush() | |
446 | + 'System.Web.HttpContext.Current.Response.End() | |
447 | + | |
448 | + | |
449 | + | |
450 | + End Sub | |
451 | + | |
452 | + | |
453 | + Public Shared Sub CreatPDF_Android() | |
454 | + | |
455 | + | |
456 | + Dim iRowHeight As Integer = 18 | |
457 | + fontDef = CreateStyle(10, Brushes.Black) | |
458 | + | |
459 | + | |
460 | + Dim iRow As IGridRow = Nothing | |
461 | + Dim iCell As IGridCell = Nothing | |
462 | + Dim iGroup As IGroup = Nothing | |
463 | + Dim iText As IText = Nothing | |
464 | + | |
465 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
466 | + CreateFont(14)), Brushes.Black) | |
467 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
468 | + CreateFont(18)), Brushes.Black) | |
469 | + | |
470 | + 'レポートを作成 | |
471 | + Dim rPDF As Report = New Report | |
472 | + | |
473 | + | |
474 | + Dim iSect As ISection = rPDF.AddSection() | |
475 | + 'ページを作成 | |
476 | + iSect.PageSize = PageSizes.A4 | |
477 | + iSect.PageOrientation = PageOrientation.Portrait | |
478 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
479 | + | |
480 | + | |
481 | + | |
482 | + 'ヘッダーを作成します | |
483 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
484 | + sectHeader.Repeat = True | |
485 | + sectHeader.Height = 110 | |
486 | + | |
487 | + | |
488 | + '要素の最初のセットを配置するためにグリッドを使用します | |
489 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
490 | + | |
491 | + | |
492 | + | |
493 | + 'グリッド要素に つの列を追加します | |
494 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
495 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
496 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
497 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
498 | + | |
499 | + iRow = iHdrGrid.AddRow() | |
500 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
501 | + iCell = iRow.AddCell() | |
502 | + iCell.ColSpan = 2 | |
503 | + iCell.Borders.All = BorderBS | |
504 | + CellAddText(iCell, "仮 発 注 書 ", Alignment.Center, fontOther2) | |
505 | + | |
506 | + | |
507 | + | |
508 | + | |
509 | + Dim outputStream As New MemoryStream | |
510 | + rPDF.Publish(outputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
511 | + | |
512 | + | |
513 | + | |
514 | + Dim outputData As Byte() = outputStream.ToArray() | |
515 | + | |
516 | + | |
517 | + | |
518 | + | |
519 | + HttpContext.Current.Response.Clear() | |
520 | + HttpContext.Current.Response.ClearHeaders() | |
521 | + HttpContext.Current.Response.Buffer = False | |
522 | + | |
523 | + HttpContext.Current.Response.ClearContent() | |
524 | + HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=debug02.pdf") | |
525 | + HttpContext.Current.Response.ContentType = "application/octet-stream" | |
526 | + HttpContext.Current.Response.BinaryWrite(outputData) | |
527 | + | |
528 | + HttpContext.Current.Response.Flush() | |
529 | + HttpContext.Current.Response.SuppressContent = True | |
530 | + HttpContext.Current.ApplicationInstance.CompleteRequest() | |
531 | + HttpContext.Current.Response.End() | |
532 | + | |
533 | + | |
534 | + | |
535 | + | |
536 | + End Sub | |
537 | + | |
538 | + | |
539 | + | |
540 | + Public Shared Sub CreatPDF_iOS() | |
541 | + | |
542 | + | |
543 | + Dim iRowHeight As Integer = 18 | |
544 | + fontDef = CreateStyle(10, Brushes.Black) | |
545 | + | |
546 | + | |
547 | + Dim iRow As IGridRow = Nothing | |
548 | + Dim iCell As IGridCell = Nothing | |
549 | + Dim iGroup As IGroup = Nothing | |
550 | + Dim iText As IText = Nothing | |
551 | + | |
552 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
553 | + CreateFont(14)), Brushes.Black) | |
554 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
555 | + CreateFont(18)), Brushes.Black) | |
556 | + | |
557 | + 'レポートを作成 | |
558 | + Dim rPDF As Report = New Report | |
559 | + | |
560 | + | |
561 | + Dim iSect As ISection = rPDF.AddSection() | |
562 | + 'ページを作成 | |
563 | + iSect.PageSize = PageSizes.A4 | |
564 | + iSect.PageOrientation = PageOrientation.Portrait | |
565 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
566 | + | |
567 | + | |
568 | + | |
569 | + 'ヘッダーを作成します | |
570 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
571 | + sectHeader.Repeat = True | |
572 | + sectHeader.Height = 110 | |
573 | + | |
574 | + | |
575 | + '要素の最初のセットを配置するためにグリッドを使用します | |
576 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
577 | + | |
578 | + | |
579 | + | |
580 | + 'グリッド要素に つの列を追加します | |
581 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
582 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
583 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
584 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
585 | + | |
586 | + iRow = iHdrGrid.AddRow() | |
587 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
588 | + iCell = iRow.AddCell() | |
589 | + iCell.ColSpan = 2 | |
590 | + iCell.Borders.All = BorderBS | |
591 | + CellAddText(iCell, "仮 発 注 書 ", Alignment.Center, fontOther2) | |
592 | + | |
593 | + | |
594 | + | |
595 | + | |
596 | + Dim PDFName As String = sFileName("仮発注書_" & Date.Now.ToString("yyyyMMdd") & ".pdf") | |
597 | + | |
598 | + | |
599 | + | |
600 | + | |
601 | + | |
602 | + HttpContext.Current.Response.Buffer = True | |
603 | + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + PDFName) | |
604 | + System.Web.HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary") | |
605 | + System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream" | |
606 | + rPDF.Publish(System.Web.HttpContext.Current.Response.OutputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
607 | + System.Web.HttpContext.Current.Response.Flush() | |
608 | + System.Web.HttpContext.Current.Response.End() | |
609 | + | |
610 | + | |
611 | + | |
612 | + End Sub | |
613 | + | |
614 | + | |
615 | + | |
616 | + | |
617 | + Public Shared Function CreatPDF_iFarm() As Byte() | |
618 | + | |
619 | + Dim iRowHeight As Integer = 18 | |
620 | + fontDef = CreateStyle(10, Brushes.Black) | |
621 | + | |
622 | + | |
623 | + Dim iRow As IGridRow = Nothing | |
624 | + Dim iCell As IGridCell = Nothing | |
625 | + Dim iGroup As IGroup = Nothing | |
626 | + Dim iText As IText = Nothing | |
627 | + | |
628 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
629 | + CreateFont(14)), Brushes.Black) | |
630 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
631 | + CreateFont(18)), Brushes.Black) | |
632 | + | |
633 | + 'レポートを作成 | |
634 | + Dim rPDF As Report = New Report | |
635 | + | |
636 | + | |
637 | + Dim iSect As ISection = rPDF.AddSection() | |
638 | + 'ページを作成 | |
639 | + iSect.PageSize = PageSizes.A4 | |
640 | + iSect.PageOrientation = PageOrientation.Portrait | |
641 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
642 | + | |
643 | + | |
644 | + | |
645 | + 'ヘッダーを作成します | |
646 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
647 | + sectHeader.Repeat = True | |
648 | + sectHeader.Height = 110 | |
649 | + | |
650 | + | |
651 | + '要素の最初のセットを配置するためにグリッドを使用します | |
652 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
653 | + | |
654 | + | |
655 | + | |
656 | + 'グリッド要素に つの列を追加します | |
657 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
658 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
659 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
660 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
661 | + | |
662 | + iRow = iHdrGrid.AddRow() | |
663 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
664 | + iCell = iRow.AddCell() | |
665 | + iCell.ColSpan = 2 | |
666 | + iCell.Borders.All = BorderBS | |
667 | + CellAddText(iCell, "仮 発 注 書 ", Alignment.Center, fontOther2) | |
668 | + | |
669 | + | |
670 | + | |
671 | + | |
672 | + Dim outputStream As New MemoryStream | |
673 | + rPDF.Publish(outputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
674 | + | |
675 | + | |
676 | + | |
677 | + CreatPDF_iFarm = outputStream.ToArray() | |
678 | + | |
679 | + | |
680 | + End Function | |
681 | + | |
682 | + | |
683 | + | |
684 | + | |
685 | + Public Shared Sub CreatPDF_Path() | |
686 | + | |
687 | + HttpContext.Current.Response.Buffer = True | |
688 | + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + "kk1.pdf") | |
689 | + System.Web.HttpContext.Current.Response.AddHeader("Content-Transfer-Encoding", "binary") | |
690 | + System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream" | |
691 | + System.Web.HttpContext.Current.Response.Flush() | |
692 | + System.Web.HttpContext.Current.Response.WriteFile("E:\wwwroot\Debug\A002\StockOut\debug.pdf") | |
693 | + System.Web.HttpContext.Current.Response.End() | |
694 | + | |
695 | + | |
696 | + | |
697 | + | |
698 | + End Sub | |
699 | + | |
700 | + | |
701 | + | |
702 | + | |
703 | + | |
704 | + | |
705 | + | |
706 | + Public Shared Sub CreatPDF_Open() | |
707 | + | |
708 | + | |
709 | + Dim iRowHeight As Integer = 18 | |
710 | + fontDef = CreateStyle(10, Brushes.Black) | |
711 | + | |
712 | + | |
713 | + Dim iRow As IGridRow = Nothing | |
714 | + Dim iCell As IGridCell = Nothing | |
715 | + Dim iGroup As IGroup = Nothing | |
716 | + Dim iText As IText = Nothing | |
717 | + | |
718 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
719 | + CreateFont(14)), Brushes.Black) | |
720 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
721 | + CreateFont(18)), Brushes.Black) | |
722 | + | |
723 | + 'レポートを作成 | |
724 | + Dim rPDF As Report = New Report | |
725 | + | |
726 | + | |
727 | + Dim iSect As ISection = rPDF.AddSection() | |
728 | + 'ページを作成 | |
729 | + iSect.PageSize = PageSizes.A4 | |
730 | + iSect.PageOrientation = PageOrientation.Portrait | |
731 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
732 | + | |
733 | + | |
734 | + | |
735 | + 'ヘッダーを作成します | |
736 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
737 | + sectHeader.Repeat = True | |
738 | + sectHeader.Height = 110 | |
739 | + | |
740 | + | |
741 | + '要素の最初のセットを配置するためにグリッドを使用します | |
742 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
743 | + | |
744 | + | |
745 | + | |
746 | + 'グリッド要素に つの列を追加します | |
747 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
748 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
749 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
750 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
751 | + | |
752 | + iRow = iHdrGrid.AddRow() | |
753 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
754 | + iCell = iRow.AddCell() | |
755 | + iCell.ColSpan = 2 | |
756 | + iCell.Borders.All = BorderBS | |
757 | + CellAddText(iCell, "仮 発 注 書 ", Alignment.Center, fontOther2) | |
758 | + | |
759 | + | |
760 | + | |
761 | + | |
762 | + Dim outputStream As New MemoryStream | |
763 | + rPDF.Publish(outputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
764 | + | |
765 | + | |
766 | + | |
767 | + Dim outputData As Byte() = outputStream.ToArray() | |
768 | + | |
769 | + | |
770 | + | |
771 | + | |
772 | + HttpContext.Current.Response.Clear() | |
773 | + HttpContext.Current.Response.ClearHeaders() | |
774 | + HttpContext.Current.Response.Buffer = False | |
775 | + | |
776 | + HttpContext.Current.Response.ClearContent() | |
777 | + HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=debug02.pdf") | |
778 | + HttpContext.Current.Response.ContentType = "application/pdf" | |
779 | + HttpContext.Current.Response.BinaryWrite(outputData) | |
780 | + | |
781 | + HttpContext.Current.Response.Flush() | |
782 | + HttpContext.Current.Response.SuppressContent = True | |
783 | + HttpContext.Current.ApplicationInstance.CompleteRequest() | |
784 | + HttpContext.Current.Response.End() | |
785 | + | |
786 | + | |
787 | + | |
788 | + | |
789 | + End Sub | |
790 | + | |
791 | + | |
792 | + | |
793 | + | |
794 | + Public Shared Sub CreatPDF_DL() | |
795 | + | |
796 | + | |
797 | + Dim iRowHeight As Integer = 18 | |
798 | + fontDef = CreateStyle(10, Brushes.Black) | |
799 | + | |
800 | + | |
801 | + Dim iRow As IGridRow = Nothing | |
802 | + Dim iCell As IGridCell = Nothing | |
803 | + Dim iGroup As IGroup = Nothing | |
804 | + Dim iText As IText = Nothing | |
805 | + | |
806 | + Dim fontOther1 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
807 | + CreateFont(14)), Brushes.Black) | |
808 | + Dim fontOther2 As Style = New Style(New Infragistics.Documents.Reports.Graphics.Font( | |
809 | + CreateFont(18)), Brushes.Black) | |
810 | + | |
811 | + 'レポートを作成 | |
812 | + Dim rPDF As Report = New Report | |
813 | + | |
814 | + | |
815 | + Dim iSect As ISection = rPDF.AddSection() | |
816 | + 'ページを作成 | |
817 | + iSect.PageSize = PageSizes.A4 | |
818 | + iSect.PageOrientation = PageOrientation.Portrait | |
819 | + iSect.PageMargins = New Margins(30, 30, 20, 20) | |
820 | + | |
821 | + | |
822 | + | |
823 | + 'ヘッダーを作成します | |
824 | + Dim sectHeader As ISectionHeader = iSect.AddHeader() | |
825 | + sectHeader.Repeat = True | |
826 | + sectHeader.Height = 110 | |
827 | + | |
828 | + | |
829 | + '要素の最初のセットを配置するためにグリッドを使用します | |
830 | + Dim iHdrGrid As IGrid = sectHeader.AddGrid(0, 0) | |
831 | + | |
832 | + | |
833 | + | |
834 | + 'グリッド要素に つの列を追加します | |
835 | + iHdrGrid.AddColumn().Width = New RelativeWidth(19) | |
836 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
837 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
838 | + iHdrGrid.AddColumn().Width = New RelativeWidth(27) | |
839 | + | |
840 | + iRow = iHdrGrid.AddRow() | |
841 | + iRow.Height = New FixedHeight(iRowHeight * 2) | |
842 | + iCell = iRow.AddCell() | |
843 | + iCell.ColSpan = 2 | |
844 | + iCell.Borders.All = BorderBS | |
845 | + CellAddText(iCell, "仮 発 注 書 ", Alignment.Center, fontOther2) | |
846 | + | |
847 | + | |
848 | + | |
849 | + | |
850 | + Dim outputStream As New MemoryStream | |
851 | + rPDF.Publish(outputStream, Infragistics.Documents.Reports.Report.FileFormat.PDF) | |
852 | + | |
853 | + | |
854 | + | |
855 | + Dim outputData As Byte() = outputStream.ToArray() | |
856 | + | |
857 | + | |
858 | + | |
859 | + | |
860 | + HttpContext.Current.Response.Clear() | |
861 | + HttpContext.Current.Response.ClearHeaders() | |
862 | + HttpContext.Current.Response.Buffer = False | |
863 | + | |
864 | + HttpContext.Current.Response.ClearContent() | |
865 | + HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=debug02.pdf") | |
866 | + HttpContext.Current.Response.ContentType = "application/octet-stream" | |
867 | + HttpContext.Current.Response.BinaryWrite(outputData) | |
868 | + | |
869 | + HttpContext.Current.Response.Flush() | |
870 | + HttpContext.Current.Response.SuppressContent = True | |
871 | + HttpContext.Current.ApplicationInstance.CompleteRequest() | |
872 | + HttpContext.Current.Response.End() | |
873 | + | |
874 | + | |
875 | + | |
876 | + | |
877 | + End Sub | |
878 | + | |
879 | + | |
880 | + | |
881 | + | |
882 | + | |
883 | + | |
884 | +End Class | |
885 | + | |
886 | + | |
887 | + | |
888 | + | |
889 | + | |
890 | + | |
891 | + |
@@ -0,0 +1,24 @@ | ||
1 | +'------------------------------------------------------------------------------ | |
2 | +' <自動生成> | |
3 | +' このコードはツールによって生成されました。 | |
4 | +' | |
5 | +' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 | |
6 | +' コードが再生成されるときに損失したりします。 | |
7 | +' </自動生成> | |
8 | +'------------------------------------------------------------------------------ | |
9 | + | |
10 | +Option Strict On | |
11 | +Option Explicit On | |
12 | + | |
13 | + | |
14 | +Partial Public Class DlAndUp | |
15 | + | |
16 | + '''<summary> | |
17 | + '''btnSubmit コントロール。 | |
18 | + '''</summary> | |
19 | + '''<remarks> | |
20 | + '''自動生成されたフィールド。 | |
21 | + '''変更するには、フィールドの宣言をデザイナー ファイルから分離コード ファイルに移動します。 | |
22 | + '''</remarks> | |
23 | + Protected WithEvents btnSubmit As Global.System.Web.UI.WebControls.Button | |
24 | +End Class |
@@ -0,0 +1,31 @@ | ||
1 | +Public Class DlAndUp | |
2 | + Inherits System.Web.UI.Page | |
3 | + | |
4 | + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load | |
5 | + ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnSubmit) | |
6 | + End Sub | |
7 | + | |
8 | + Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click | |
9 | + | |
10 | + Dim DL As Byte() = RptPDF00.CreatPDF_iFarm() | |
11 | + | |
12 | + | |
13 | + | |
14 | + 'HttpContext.Current.Response.Clear() | |
15 | + 'HttpContext.Current.Response.ClearHeaders() | |
16 | + 'HttpContext.Current.Response.Buffer = False | |
17 | + | |
18 | + 'HttpContext.Current.Response.ClearContent() | |
19 | + HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=debug02.pdf") | |
20 | + HttpContext.Current.Response.ContentType = "application/octet-stream" | |
21 | + HttpContext.Current.Response.BinaryWrite(DL) | |
22 | + | |
23 | + HttpContext.Current.Response.Flush() | |
24 | + HttpContext.Current.Response.SuppressContent = True | |
25 | + HttpContext.Current.ApplicationInstance.CompleteRequest() | |
26 | + | |
27 | + | |
28 | + End Sub | |
29 | + | |
30 | + | |
31 | +End Class | |
\ No newline at end of file |