private void CreatePDFLandScape(int LabID, int FrontOfficeID, string TestReportNo, int SampleCode, int Division, int Commodity, CheckBox chklogo, CheckBox chkWithSign) { string Suffix = string.Empty; string fileName = string.Empty; List<string> filelist = new List<string>(); for (int Type = 0; Type <= 1; Type++) { try { ResultForwardingMemo SFM = new ResultForwardingMemo(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt = DataAccess.GetDataTable(DBProcedure.DateChecking); DataTable dtHDR = new DataTable(); DataTable dtDTL = new DataTable(); DataSet dsTestReport = SFM.GetTestReport(FrontOfficeID, LabID, TestReportNo, SampleCode, Convert.ToInt16(SessionManager.Instance.RoleId), Division, Commodity); DataTable dtDates = dsTestReport.Tables[0]; DataTable dtTestReport = dsTestReport.Tables[1];
DataSet dsViewSample = new DataSet();//SFM.GetSampleDetails(FrontOfficeID, LabID, TestReportNo, SampleCode, Type); DataTable dtMainSample = new DataTable();//dsViewSample.Tables[1]; DataTable dtSampleLlst = new DataTable();//dsViewSample.Tables[0]; DataTable distinctParameter = new DataTable(); try { using (SqlConnection con = new SqlConnection(strConnString)) { using (SqlCommand cmd = new SqlCommand("GetSampleDetails", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@vFrontOfficeID", SqlDbType.Int).Value = FrontOfficeID; cmd.Parameters.Add("@vLabID", SqlDbType.Int).Value = LabID; cmd.Parameters.Add("@TestReportNo", SqlDbType.NVarChar).Value = TestReportNo; cmd.Parameters.Add("@SampleCodeId", SqlDbType.NVarChar).Value = SampleCode; cmd.Parameters.Add("@Type", SqlDbType.NVarChar).Value = Type; cmd.CommandTimeout = 0; SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dsViewSample); dtMainSample = dsViewSample.Tables[1]; dtSampleLlst = dsViewSample.Tables[0]; } } } catch (Exception ex) {
} DataRow[] foundNablRows; foundNablRows = dtSampleLlst.Select("IS_ELIGIBLE_FOR_NABL_LOGO = 'NO'");
//if (dtSampleLlst.Rows[0]["TOTAL_ROWS"].ToString() != dtSampleLlst.Rows[0]["TOTAL_BLANK_ROWS"].ToString()) //{ Guid obj = Guid.NewGuid(); string QRCodelink = RemoteDwnldUrl + obj.ToString(); string UfileName = dtTestReport.Rows[0]["TestReportNo"].ToString().Replace("/", "_");// + "_" + Type + "_" + SessionManager.Instance.UserId.ToString() + ".pdf"; string pdf_fileName = dtTestReport.Rows[0]["TestReportNo"].ToString().Replace("/", "_") + "_" + Type + "_" + SessionManager.Instance.UserId.ToString() + ".pdf"; try { Save(LabID, UfileName, pdf_fileName, 0, "", "", "", ""); } catch (Exception ex) { } fileName = dtTestReport.Rows[0]["TestReportNo"].ToString().Replace("/", "_"); Font NormalFont = FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK); string pdfFileName = ConfigurationManager.AppSettings["CopyOfTestResult"].ToString() + fileName + "_" + Type + "_" + SessionManager.Instance.UserId.ToString() + ".pdf"; filelist.Add(pdfFileName); try { if (File.Exists(pdfFileName)) File.Delete(pdfFileName); } catch (Exception ex) {
} // Document document = new Document(PageSize.A4.Rotate(), 0, 0, 5, 0); Document document = new Document(new RectangleReadOnly(842, 595), 88f, 88f, 10f, 10f); // document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); // Document document = new Document(PageSize.A4, 10, 10, 13, 62); // Document document = new Document(PageSize.A4, 88f, 88f, 10f, 10f); //Added by sandeep PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(pdfFileName, FileMode.Create));
_RevNumber = dtTestReport.Rows[0]["RevNumber"].ToString(); _RevDate = dtTestReport.Rows[0]["RevDate"].ToString(); if (foundNablRows.Count() == 0) // if there is no **mark on result then ulr no shall be shown { FULRNo = dtTestReport.Rows[0]["ULRNo"].ToString(); } else { FULRNo = ""; } FNablNo = dtTestReport.Rows[0]["NablNo"].ToString(); string Branch = dtTestReport.Rows[0]["LabID"].ToString(); Footer PageEventHandler = new Footer(FULRNo, FNablNo, _RevNumber, _RevDate, Branch, QRCodelink); writer.PageEvent = PageEventHandler;
#region tables
PdfPCell cell = new PdfPCell(); float[] columnDefinitionSize = { 10F, 10F }; PdfPTable table = new PdfPTable(columnDefinitionSize); table.WidthPercentage = 100;
float[] columnDefinitionSize2 = { 10F, 10F }; PdfPTable table2 = new PdfPTable(columnDefinitionSize2); table2.WidthPercentage = 100;
float[] columnDefinitionSize3 = { 30F, 30F, 40F }; PdfPTable tableScope = new PdfPTable(columnDefinitionSize3); tableScope.WidthPercentage = 100;
float[] columnDefinitionSize31 = { 35F, 65F }; PdfPTable tableScope1 = new PdfPTable(columnDefinitionSize31); tableScope1.WidthPercentage = 100;
float[] columnDefinitionSizeHeader = { 20F, 20F, 30F }; PdfPTable tableHeader = new PdfPTable(columnDefinitionSizeHeader); tableHeader.WidthPercentage = 100;
float[] columnDefinitionSize7 = { 100F }; PdfPTable table7 = new PdfPTable(columnDefinitionSize7); table7.WidthPercentage = 100f;
float[] columnSmallSize = { 100F }; PdfPTable tableSmallSize = new PdfPTable(columnSmallSize); tableSmallSize.WidthPercentage = 35f;
float[] columnDefinitionSize4 = { 100F }; PdfPTable tableResumeDetails = new PdfPTable(columnDefinitionSize4); tableResumeDetails.WidthPercentage = 100;
float[] columnDefinitionSize9 = { 100F }; PdfPTable tableClientName = new PdfPTable(columnDefinitionSize9); tableClientName.WidthPercentage = 100;
float[] columnDefinitionSize5 = { 21F, 79F }; PdfPTable tableContactDetails = new PdfPTable(columnDefinitionSize5); tableContactDetails.WidthPercentage = 100;
float[] columnDefinitionSize6 = { 80F, 20F }; PdfPTable tableContactDetailsWithImage = new PdfPTable(columnDefinitionSize6); tableContactDetailsWithImage.WidthPercentage = 100;
float[] columnDefinitionSize8 = { 2F, 95F };
float[] columnMain = { 20F, 20F }; PdfPTable tableMain = new PdfPTable(columnMain); tableContactDetailsWithImage.WidthPercentage = 100;
float[] ColumnDescription = { 35f, 40f, 10f, 15f }; PdfPTable tablePlan = new PdfPTable(ColumnDescription);
float[] ColumnHeading = { 95f, 10f }; float[] ColumnData = { 35f, 65f }; #endregion
#region NEW add
float[] columnNew = { 100f }; PdfPTable tableNew = new PdfPTable(columnNew); #endregion
pdfPage page_FR = new pdfPage(); writer.PageEvent = page_FR;
if (dtTestReport.Rows.Count > 0) { page_FR._TestReportNo = dtTestReport.Rows[0]["TestReportNo"].ToString(); page_FR._TestReportDate = dtTestReport.Rows[0]["ReportDate"].ToString(); }
document.Open();
#region Logo iTextSharp.text.Image addLogo = default(iTextSharp.text.Image); iTextSharp.text.Image addBlamkLogo = default(iTextSharp.text.Image); if (dtTestReport.Rows[0]["LOGOCHANGE"].ToString() == "2") { addLogo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/App_Themes/Images/Inspectorate_Transition-Logo_Gold.png")); } else { addLogo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/App_Themes/Images/logo.png")); } addBlamkLogo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/App_Themes/Images/Blank.png")); tableSmallSize = new PdfPTable(new float[] { 40, 50, 10 });
if (chklogo.Checked) tableSmallSize.AddCell(new PdfPCell(new Paragraph("", largeFontBold)) { BorderWidth = 0f, HorizontalAlignment = Element.ALIGN_LEFT }); else tableSmallSize.AddCell(new PdfPCell(new Paragraph("Inspectorate Griffith India Pvt. Ltd" + Environment.NewLine + dtTestReport.Rows[0]["BranchName"].ToString() + Environment.NewLine + dtTestReport.Rows[0]["BranchAddress"].ToString(), NormalFontBold)) { BorderWidth = 0f, HorizontalAlignment = Element.ALIGN_LEFT });
Paragraph ParagraphTitle = new Paragraph("", largeFontBold); // Paragraph ParagraphTitle = new Paragraph("Address", largeFontBold); ParagraphTitle.Alignment = 0; tableSmallSize.HorizontalAlignment = 0; tableSmallSize.WidthPercentage = 100; tableSmallSize.DefaultCell.BorderWidth = 0f; tableSmallSize.DefaultCell.HorizontalAlignment = 0; tableSmallSize.AddCell(ParagraphTitle);
//with or without log print if (chklogo.Checked) { tableSmallSize.AddCell(addBlamkLogo); } else { addLogo.ScaleAbsolute(55, 70); tableSmallSize.AddCell(new PdfPCell(addLogo) { BorderWidth = 0f, HorizontalAlignment = Element.ALIGN_LEFT, PaddingTop = 3 }); //tableSmallSize.AddCell(addLogo); } document.Add(tableSmallSize);
#endregion
#region Report Header Paragraph ParagraphNewLine = new Paragraph(); ParagraphNewLine.Add(Environment.NewLine); ParagraphNewLine.ExtraParagraphSpace = 3;
Paragraph P1 = new Paragraph("TEST REPORT", ExtralargeFontBoldUnderline); P1.Alignment = 1;
document.Add(P1); document.Add(ParagraphNewLine); #endregion
#region Test Details Paragraph P2 = new Paragraph("TEST REPORT NO. :", smallFontBold); P2.Alignment = 0; P2.Font = smallFontBold; Paragraph P3 = new Paragraph(dtTestReport.Rows[0]["TestReportNo"].ToString() + Suffix, smallFontBold); // if with scope and without scope both are there in the TESTREPORT then 1 will be added in the next one. P3.Alignment = 0; P3.Font = smallFontBold; tablePlan = SetCellFormatting(tablePlan, 0, P2, P3, 100, smallFontBold, 0);
Paragraph P4 = new Paragraph("DATE :", smallFontBold); P4.Alignment = 0; P4.Font = smallFontBold; Paragraph P5 = new Paragraph(dtTestReport.Rows[0]["ReportDate"].ToString(), smallFontBold); P5.Alignment = 0; P5.Font = smallFontBold; tablePlan = SetCellFormatting(tablePlan, 0, P4, P5, 100, smallFontBold, 0);
document.Add(tablePlan); //////////////////////////////////////////////////////////////////////////// if (foundNablRows.Count() == 0) { if (!string.IsNullOrEmpty(dtTestReport.Rows[0]["ULRNo"].ToString())) { Paragraph P22 = new Paragraph("ULR No. :", smallFontBold); P22.Alignment = 0; P22.Font = smallFontBold; Paragraph P33 = new Paragraph(dtTestReport.Rows[0]["ULRNo"].ToString(), smallFontBold); P33.Alignment = 0; P33.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P22, P33, 100, smallFontBold, 0); } } Paragraph P6 = new Paragraph("*NAME & ADDRESS OF CUSTOMER :", smallFontBold); P6.Alignment = 0; P6.Font = smallFontBold; Paragraph P7 = new Paragraph(dtTestReport.Rows[0]["CustomerAddress"].ToString(), smallFontBold); P7.Alignment = 0; P7.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P6, P7, 100, smallFontBold, 0); document.Add(tableScope1); ///////////////////////////////////////////////////////////////////////////// tablePlan = new PdfPTable(ColumnDescription); Paragraph P8 = new Paragraph("*CUSTOMERS REFERENCE :", smallFontBold); P8.Alignment = 0; P8.Font = smallFontBold; Paragraph P9 = new Paragraph(dtTestReport.Rows[0]["CustomerRef"].ToString(), smallFontBold); P9.Alignment = 0; P9.Font = smallFontBold; tablePlan = SetCellFormatting(tablePlan, 0, P8, P9, 100, smallFontBold, 0);
Paragraph P10 = new Paragraph("DATE :", smallFontBold); P10.Alignment = 0; P10.Font = smallFontBold; Paragraph P11 = new Paragraph(dtTestReport.Rows[0]["CustomerRefDate"].ToString(), smallFontBold); P11.Alignment = 0; P11.Font = smallFontBold; tablePlan = SetCellFormatting(tablePlan, 0, P10, P11, 100, smallFontBold, 0); document.Add(tablePlan); //////////////////////////////////////////////////////////////////////////// tableScope1 = new PdfPTable(columnDefinitionSize31); Paragraph P12 = new Paragraph("SAMPLE PARTICULARS :", smallFontBold); P12.Alignment = 0; P12.Font = smallFontBold; Paragraph P13 = new Paragraph(dtTestReport.Rows[0]["SampleParticulars"].ToString(), smallFontBold); P13.Alignment = 0; P13.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P12, P13, 100, smallFontBold, 0); //////////////////////////////////////////////////////////////////////////// Paragraph P14 = new Paragraph("SAMPLE RECEIPT DATE :", smallFontBold); P14.Alignment = 0; P14.Font = smallFontBold; Paragraph P15 = new Paragraph(dtTestReport.Rows[0]["SampleReceiptDate"].ToString(), smallFontBold); P15.Alignment = 0; P15.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P14, P15, 100, smallFontBold, 0); //////////////////////////////////////////////////////////////////////////// Paragraph P16 = new Paragraph("NO. OF SAMPLE(S) :", smallFontBold); P16.Alignment = 0; P16.Font = smallFontBold; Paragraph P17 = new Paragraph(dtTestReport.Rows[0]["SampleNo"].ToString(), smallFontBold); P17.Alignment = 0; P17.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P16, P17, 100, smallFontBold, 0); //////////////////////////////////////////////////////////////////////////// Paragraph P18 = new Paragraph("*SAMPLE DESCRIPTION :", smallFontBold); P18.Alignment = 0; P18.Font = smallFontBold; Paragraph P19 = new Paragraph(dtTestReport.Rows[0]["SampleDescription"].ToString(), smallFontBold); P19.Alignment = 0; P19.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P18, P19, 100, smallFontBold, 0); //////////////////////////////////////////////////////////////////////////// Paragraph P20 = new Paragraph("CONDITION OF SAMPLE :", smallFontBold); P20.Alignment = 0; P20.Font = smallFontBold; Paragraph P21 = new Paragraph(dtTestReport.Rows[0]["SampleCondition"].ToString(), smallFontBold); //Paragraph P21 = new Paragraph("", NormalFontTable); P21.Alignment = 0; P21.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P20, P21, 100, smallFontBold, 0); ///////////////////////////////////////////////////////////////////////////// if (dtTestReport.Rows[0]["GroupNameVisible"].ToString() == "1") { if (!string.IsNullOrEmpty(dtTestReport.Rows[0]["ULRNo"].ToString())) { if (!string.IsNullOrEmpty(dtTestReport.Rows[0]["GroupName"].ToString())) { Paragraph P34 = new Paragraph("CHEMICAL TESTING :", smallFontBold); P34.Alignment = 0; P34.Font = smallFontBold; Paragraph P35 = new Paragraph(dtTestReport.Rows[0]["GroupName"].ToString(), smallFontBold); P35.Alignment = 0; P35.Font = smallFontBold; tableScope1 = SetCellFormatting(tableScope1, 0, P34, P35, 100, smallFontBold, 0); } } } //////////////////////////////////////////////////////////////////////////// //Paragraph P22 = new Paragraph("*PARAMETERS TESTED :", smallFontBold); //P22.Alignment = 0; //P22.Font = smallFontBold; //Paragraph P23 = new Paragraph("", smallFontBold); //P23.Alignment = 0; //P23.Font = smallFontBold; //tableScope1 = SetCellFormatting(tableScope1, 0, P22, P23, 100, smallFontBold, 0); //////////////////////////////////////////////////////////////////////////// #endregion
document.Add(tableScope1);
int j = 0; int k = 0;
#region tableResumeDetails = new PdfPTable(new float[] { 7, 16, 11, 11, 11, 11, 11, 11, 11 }); tableResumeDetails.WidthPercentage = 100;
Paragraph P1111 = new Paragraph("TEST RESULTS", NormalFontBold); P1111.Alignment = 1; document.Add(P1111);
#region TEST RESULT GENERATING tableResumeDetails.AddCell(new PdfPCell(new Phrase("ANALYSIS COMMENCEMENT DATE: ", smallFontBold)) { HorizontalAlignment = 1, Colspan = 2 }); tableResumeDetails.AddCell(new PdfPCell(new Phrase(dtDates.Rows[0]["AnalysisCommDate"].ToString(), smallFontBold))); tableResumeDetails.AddCell(new PdfPCell(new Phrase("ANALYSIS COMPLETION DATE:", smallFontBold)) { HorizontalAlignment = 1, Colspan = 5 }); //--20170822 tableResumeDetails.AddCell(new PdfPCell(new Phrase(dtDates.Rows[0]["AnalysisCompDate"].ToString(), smallFontBold))); PdfPCell cellRD; if (dtSampleLlst.Rows.Count > 0) // if any Sample code result issue occurs then we shall go forward from this regeion to sort out. {
DataView viewSampleLlst = new DataView(dtSampleLlst); distinctParameter = viewSampleLlst.ToTable(true, "ParameterID", "TestingParam", "MethodID", "TestStandardName", "MethodNoID", "TestingSubMethodName", "OutOfScope", "UnitName", "TestCondition"); Paragraph text4 = new Paragraph("SAMPLE CODE", smallFontBold); Paragraph text6 = new Paragraph("*SAMPLE REF/ID(Customer)", smallFontBold); Paragraph text1 = new Paragraph("PARAMETERS", smallFontBold); int aa = (int)Math.Ceiling((double)distinctParameter.Rows.Count / 7); int startNoofDt = 0; int TestStandardNameCount = 0; int TestingSubMethodNameCount = 0; int ResultCount = 0; for (int TableCount = 0; TableCount < aa; TableCount++) {
cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; text4.Alignment = 1; text4.ExtraParagraphSpace = 0; text4.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.Rowspan = 3; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(text4); tableResumeDetails.AddCell(cellRD);
cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; text6.Alignment = 1; text6.ExtraParagraphSpace = 0; text6.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.Rowspan = 3; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(text6); tableResumeDetails.AddCell(cellRD);
//change 20210804 //cellRD = new PdfPCell(); //cellRD.ExtraParagraphSpace = 0f; //text1.Alignment = 1; //cellRD.HorizontalAlignment = 1; //cellRD.VerticalAlignment = 1; //cellRD.PaddingTop = 0f; //cellRD.PaddingBottom = 0f; //cellRD.BorderWidth = .1f; //text1.ExtraParagraphSpace = 0f; //text1.SpacingAfter = 4f; //cellRD.AddElement(text1); //tableResumeDetails.AddCell(cellRD); //change 20210804
if (distinctParameter.Rows.Count > 0) // if any Sample code result issue occurs then we shall go forward from this regeion to sort out. { int maxCol = 7;//--20170822 string[] ParameterID = new string[7];//--20170822 string[] MethodID = new string[maxCol]; string[] MethodNoID = new string[maxCol]; string[] SampleCodeId = new string[dtMainSample.Rows.Count];
string[] TestCondition = new string[7];//--20170829
int ParameterIDArrayIndex = 0; for (; (startNoofDt < distinctParameter.Rows.Count) && (maxCol != 0); startNoofDt++) { Paragraph TestingParam = new Paragraph(distinctParameter.Rows[startNoofDt]["OutOfScope"].ToString() + distinctParameter.Rows[startNoofDt]["TestingParam"].ToString(), smallFontBold); ParameterID[ParameterIDArrayIndex] = distinctParameter.Rows[startNoofDt]["ParameterID"].ToString(); TestCondition[ParameterIDArrayIndex] = distinctParameter.Rows[startNoofDt]["TestCondition"].ToString(); cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; TestingParam.Alignment = 1; TestingParam.ExtraParagraphSpace = 0; TestingParam.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(TestingParam); tableResumeDetails.AddCell(cellRD); maxCol--; ParameterIDArrayIndex++; } Paragraph Blank = new Paragraph("----", smallFontBold); //"----" 2018-01-30 PdfPCell cellRD1; for (int i = 0; i < maxCol; i++) { cellRD1 = new PdfPCell(); cellRD1.ExtraParagraphSpace = 0f; Blank.Alignment = 1; Blank.ExtraParagraphSpace = 0; Blank.SpacingAfter = 4f; cellRD1.HorizontalAlignment = 1; cellRD1.VerticalAlignment = 1; cellRD1.PaddingTop = 0f; cellRD1.PaddingBottom = 0f; cellRD1.BorderWidth = .1f; cellRD1.AddElement(Blank); tableResumeDetails.AddCell(cellRD1); }
//Paragraph Methods = new Paragraph("METHODS", smallFontBold); //cellRD1 = new PdfPCell(); //cellRD1.ExtraParagraphSpace = 0f; //Methods.Alignment = 1; //cellRD1.Rowspan = 2; //cellRD1.HorizontalAlignment = 1; //cellRD1.VerticalAlignment = 1; //cellRD1.PaddingTop = 0f; //cellRD1.PaddingBottom = 0f; //cellRD1.BorderWidth = .1f; //Methods.ExtraParagraphSpace = 0f; //Methods.SpacingAfter = 4f; //cellRD1.AddElement(Methods); //tableResumeDetails.AddCell(cellRD1);
int maxColTestStandard = 7;//--20170822 int MethodIDArrayIndex = 0; for (; (TestStandardNameCount < distinctParameter.Rows.Count) && (maxColTestStandard != 0); TestStandardNameCount++) { Paragraph MethodName = new Paragraph(distinctParameter.Rows[TestStandardNameCount]["TestStandardName"].ToString(), smallFontBold); MethodID[MethodIDArrayIndex] = distinctParameter.Rows[TestStandardNameCount]["MethodID"].ToString(); TestCondition[MethodIDArrayIndex] = distinctParameter.Rows[TestStandardNameCount]["TestCondition"].ToString(); cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; MethodName.Alignment = 1; MethodName.ExtraParagraphSpace = 0; MethodName.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.BorderWidthBottom = 0f; cellRD.AddElement(MethodName); tableResumeDetails.AddCell(cellRD); maxColTestStandard--; MethodIDArrayIndex++; }
for (int i = 0; i < maxColTestStandard; i++) { cellRD1 = new PdfPCell(); cellRD1.ExtraParagraphSpace = 0f; Blank.Alignment = 1; Blank.ExtraParagraphSpace = 0; Blank.SpacingAfter = 4f; cellRD1.HorizontalAlignment = 1; cellRD1.VerticalAlignment = 1; cellRD1.PaddingTop = 0f; cellRD1.PaddingBottom = 0f; cellRD1.BorderWidth = .1f; cellRD1.BorderWidthBottom = 0f; cellRD1.AddElement(Blank); tableResumeDetails.AddCell(cellRD1); } int maxColSubMethod = 7;//--20170822 int MethodNoIDArrayIndex = 0; for (; (TestingSubMethodNameCount < distinctParameter.Rows.Count) && (maxColSubMethod != 0); TestingSubMethodNameCount++) { Paragraph SubMethodName = new Paragraph(distinctParameter.Rows[TestingSubMethodNameCount]["TestingSubMethodName"].ToString() == "----" ? "----" : distinctParameter.Rows[TestingSubMethodNameCount]["TestingSubMethodName"].ToString() + " (" + distinctParameter.Rows[TestingSubMethodNameCount]["TestCondition"].ToString() + ") " + distinctParameter.Rows[TestingSubMethodNameCount]["UnitName"].ToString(), smallFontBold); MethodNoID[MethodNoIDArrayIndex] = distinctParameter.Rows[TestingSubMethodNameCount]["MethodNoID"].ToString(); TestCondition[MethodNoIDArrayIndex] = distinctParameter.Rows[TestingSubMethodNameCount]["TestCondition"].ToString(); cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; SubMethodName.Alignment = 1; SubMethodName.ExtraParagraphSpace = 0; SubMethodName.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.BorderWidthTop = 0f; cellRD.AddElement(SubMethodName); tableResumeDetails.AddCell(cellRD); maxColSubMethod--; MethodNoIDArrayIndex++; } for (int i = 0; i < maxColSubMethod; i++) { cellRD1 = new PdfPCell(); cellRD1.ExtraParagraphSpace = 0f; Blank.Alignment = 1; Blank.ExtraParagraphSpace = 0; Blank.SpacingAfter = 4f; cellRD1.HorizontalAlignment = 1; cellRD1.VerticalAlignment = 1; cellRD1.PaddingTop = 0f; cellRD1.PaddingBottom = 0f; cellRD1.BorderWidth = .1f; cellRD1.BorderWidthTop = 0f; cellRD1.AddElement(Blank); tableResumeDetails.AddCell(cellRD1); } /* Changed 17-11-2017 */ Paragraph ParagraphNewLine2 = new Paragraph(); ; ParagraphNewLine2.SpacingAfter = .1f; document.Add(ParagraphNewLine2); if (dtMainSample.Rows.Count > 0) { for (int i = 0; i < dtMainSample.Rows.Count; i++) { Paragraph SampleCodeValue = new Paragraph(dtMainSample.Rows[i]["SampleCode"].ToString(), smallFont6); //16 SampleCodeId[i] = dtMainSample.Rows[i]["SampleCodeId"].ToString(); cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; SampleCodeValue.Alignment = 1; SampleCodeValue.ExtraParagraphSpace = 0; SampleCodeValue.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(SampleCodeValue); tableResumeDetails.AddCell(cellRD);
Paragraph SampleRefNoVal = new Paragraph(dtMainSample.Rows[i]["SampleRefNo"].ToString(), smallFont6); //16 cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; SampleRefNoVal.Alignment = 1; SampleRefNoVal.ExtraParagraphSpace = 0; SampleRefNoVal.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(SampleRefNoVal); tableResumeDetails.AddCell(cellRD);
//Paragraph SampleBlankVal = new Paragraph("", smallFontBold); //cellRD = new PdfPCell(); //cellRD.ExtraParagraphSpace = 0f; //SampleRefNoVal.Alignment = 1; //SampleRefNoVal.ExtraParagraphSpace = 0; //SampleRefNoVal.SpacingAfter = 4f; //cellRD.HorizontalAlignment = 1; //cellRD.VerticalAlignment = 1; //cellRD.PaddingTop = 0f; //cellRD.PaddingBottom = 0f; //if (i + 1 == dtMainSample.Rows.Count) //{ // cellRD.BorderWidth = 0f; // cellRD.BorderWidthBottom = .1f;
//} //else if (writer.PageNumber > 1) //{ // cellRD.BorderWidth = 0f; // cellRD.BorderWidthBottom = .1f; //} //else //{ // cellRD.BorderWidth = 0f; //} //cellRD.AddElement(SampleBlankVal); //tableResumeDetails.AddCell(cellRD);
int maxColResult = 7;//--20170822
int TotalCount = 0; string LabTestID = "0"; j = 0;
int NextParamID = 0; Paragraph Result = new Paragraph(); DataView dvLabReg = new DataView(dtSampleLlst); for (int ResultCount1 = 0; ResultCount1 < ParameterID.Length; ResultCount1++) {
// if any Sample code result issue occurs then we shall go forward from this regeion to sort out. if (ParameterID[ResultCount1] != null && MethodID[ResultCount1] != null && MethodNoID[ResultCount1] != null) { if (dtMainSample.Rows.Count > 1) {
TotalCount = 0; DataRow[] foundRows; // 30-01-2018 foundRows = dtSampleLlst.Select("ParameterID =" + "'" + ParameterID[ResultCount1] + "'" + " and MethodID=" + "'" + MethodID[ResultCount1] + "'" + " and MethodNoID=" + "'" + MethodNoID[ResultCount1] + "'" + " and LabRegisterID=" + dtMainSample.Rows[i]["LabRegisterID"].ToString()); TotalCount = foundRows.Length; NextParamID = Convert.ToInt32(ParameterID[ResultCount1]); if (foundRows.Count() > 0) { LabTestID = foundRows[0]["LabTestID"].ToString(); } if (foundRows.Length > 1) {
dvLabReg.RowFilter = "ParameterID =" + ParameterID[ResultCount1] + " and MethodID=" + MethodID[ResultCount1] + " and MethodNoID=" + MethodNoID[ResultCount1] + " and LabRegisterID=" + dtMainSample.Rows[i]["LabRegisterID"].ToString() + " and TestCondition='" + foundRows[j]["TestCondition"].ToString() + "'";// for more than one sample with same parameter different testconditonn 30-01-2018 } if (foundRows.Count() > 0) {
dvLabReg.RowFilter = "ParameterID =" + ParameterID[ResultCount1] + " and MethodID=" + MethodID[ResultCount1] + " and MethodNoID=" + MethodNoID[ResultCount1] + " and LabRegisterID=" + dtMainSample.Rows[i]["LabRegisterID"].ToString() + " and TestCondition='" + foundRows[0]["TestCondition"].ToString() + "'";// for more than one sample without same parameter 30-01-2018 } } else { dvLabReg.RowFilter = "ParameterID =" + ParameterID[ResultCount1] + " and MethodID=" + MethodID[ResultCount1] + " and MethodNoID=" + MethodNoID[ResultCount1] + " and LabRegisterID=" + dtMainSample.Rows[i]["LabRegisterID"].ToString() + " and TestCondition='" + dtSampleLlst.Rows[k]["TestCondition"].ToString() + "'"; // testcondition new add 30-01-2018 k++; } DataTable dtByLabRegID = dvLabReg.ToTable(); if (dtByLabRegID.Rows.Count > 0) { if (TotalCount > 1) { Result = new Paragraph(dtByLabRegID.Rows[0]["Result"].ToString(), smallFontBold); //16 //j++; } else { Result = new Paragraph(dtByLabRegID.Rows[0]["Result"].ToString(), smallFontBold); //16 } cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; Result.Alignment = 1; Result.ExtraParagraphSpace = 0; Result.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(Result); tableResumeDetails.AddCell(cellRD); maxColResult--; } else { break; }
dvLabReg.RowFilter = "LabTestID = " + LabTestID; // MyValue here is a column name
// Delete these rows. foreach (DataRowView row in dvLabReg) { row.Delete(); } } } for (int a = 0; a < maxColResult; a++) { cellRD1 = new PdfPCell(); cellRD1.ExtraParagraphSpace = 0f; Blank.Alignment = 1; Blank.ExtraParagraphSpace = 0; Blank.SpacingAfter = 4f; cellRD1.HorizontalAlignment = 1; cellRD1.VerticalAlignment = 1; cellRD1.PaddingTop = 0f; cellRD1.PaddingBottom = 0f; cellRD1.BorderWidth = .1f; cellRD1.AddElement(Blank); tableResumeDetails.AddCell(cellRD1);
} } } }
Paragraph Blank1 = new Paragraph("", smallFontBold); PdfPCell cellRD2; cellRD2 = new PdfPCell(); cellRD2.ExtraParagraphSpace = 0f; Blank1.Alignment = 1; Blank1.ExtraParagraphSpace = 0; Blank1.SpacingAfter = 4f; cellRD2.Colspan = 10; //20170822 cellRD2.HorizontalAlignment = 1; cellRD2.VerticalAlignment = 1; cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = 0f; cellRD2.AddElement(Blank1); tableResumeDetails.AddCell(cellRD2); startNoofDt = ((TableCount + 1) * 7);//20170822 TestStandardNameCount = ((TableCount + 1) * 7);//2017082 TestingSubMethodNameCount = ((TableCount + 1) * 7);//2017082 ResultCount = ((TableCount + 1) * 7);//2017082 j++; // 20180130 continue; } }
Paragraph text5 = new Paragraph("RESULT", smallFontBold); cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; tableResumeDetails.AddCell(cellRD);
cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; tableResumeDetails.AddCell(cellRD);
cellRD = new PdfPCell(); cellRD.ExtraParagraphSpace = 0f; text5.Alignment = 1; text5.ExtraParagraphSpace = 0; text5.SpacingAfter = 4f; cellRD.HorizontalAlignment = 1; cellRD.VerticalAlignment = 1; cellRD.PaddingTop = 0f; cellRD.PaddingBottom = 0f; cellRD.BorderWidth = .1f; cellRD.AddElement(text5); tableResumeDetails.AddCell(cellRD);
document.Add(tableResumeDetails);
foreach (DataRow dtRow in dtDTL.Rows) { foreach (DataColumn dc in dtDTL.Columns) { var field1 = dtRow["ParameterName"].ToString(); var field2 = dtRow["TestStandardName"].ToString(); var field3 = dtRow["TestingSubMethodName"].ToString(); var field4 = dtRow["SampleCode"].ToString(); var field5 = dtRow["Result"].ToString(); var field6 = dtRow["SampleRefID"].ToString(); tableResumeDetails = new PdfPTable(new float[] { 15, 20, 20, 15, 15, 15 }); tableResumeDetails.WidthPercentage = 100; Paragraph textDate4 = new Paragraph(field4, smallFont6); Paragraph textDate6 = new Paragraph(field6, smallFont6); Paragraph textDate1 = new Paragraph(field1, smallFont6); Paragraph textDate2 = new Paragraph(field2, smallFont6); Paragraph textDate3 = new Paragraph(field3, smallFont6);
Paragraph textDate5 = new Paragraph(field5, smallFont6); PdfPCell cellRD2;
cellRD2 = new PdfPCell(); cellRD2.ExtraParagraphSpace = 0f;
textDate4.Alignment = 1; textDate4.ExtraParagraphSpace = 0; textDate4.SpacingAfter = 4f;
cellRD2.HorizontalAlignment = 1; cellRD2.VerticalAlignment = 1;
cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = .1f; cellRD2.AddElement(textDate4); tableResumeDetails.AddCell(cellRD2);
textDate6.Alignment = 1; textDate6.ExtraParagraphSpace = 0; textDate6.SpacingAfter = 4f;
cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = .1f; cellRD2.AddElement(textDate6); tableResumeDetails.AddCell(cellRD2);
textDate1.Alignment = 1;
cellRD2.BorderWidth = .1f; textDate1.ExtraParagraphSpace = 0f; textDate1.SpacingAfter = 4f; cellRD2.AddElement(textDate1); tableResumeDetails.AddCell(cellRD2);
textDate2.Alignment = 1; textDate2.ExtraParagraphSpace = 0; textDate2.SpacingAfter = 4f;
cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = .1f; cellRD2.AddElement(textDate2); tableResumeDetails.AddCell(cellRD2);
textDate3.Alignment = 1; textDate3.ExtraParagraphSpace = 0; textDate3.SpacingAfter = 4f;
cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = .1f; cellRD2.AddElement(textDate3); tableResumeDetails.AddCell(cellRD2);
textDate5.Alignment = 1; textDate5.ExtraParagraphSpace = 0; textDate5.SpacingAfter = 4f;
cellRD2.PaddingTop = 0f; cellRD2.PaddingBottom = 0f; cellRD2.BorderWidth = .1f; cellRD2.AddElement(textDate5); tableResumeDetails.AddCell(cellRD2); } document.Add(tableResumeDetails); } #endregion
#region new add //document.Add(ParagraphNewLine); // document.Add(ParagraphNewLine);
float[] columnDefinitionSize310 = { 60 }; PdfPTable tableScope10 = new PdfPTable(columnDefinitionSize310); tableScope10.WidthPercentage = 100; //if ((dtMainSample.Rows.Count >= 18) || (distinctParameter.Rows.Count>7)) //{ // document.NewPage(); //}
Paragraph P200 = new Paragraph("REMARKS :", NormalFontBold); P200.Alignment = 0; P200.Font = NormalFontBold; Paragraph P210 = new Paragraph("", NormalFontTable); P210.Alignment = 0; P210.Font = NormalFontBold; tableScope10 = SetCellFormatting(tableScope10, 0, P200, P210, 100, NormalFontTable, 0);
PdfPCell cellnew = new PdfPCell(); cellnew = new PdfPCell(new Phrase(dtTestReport.Rows[0]["Remarks"].ToString(), NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_LEFT; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingTop = 0f; cellnew.PaddingBottom = 4f; cellnew.BorderWidth = .1f; tableScope10.AddCell(cellnew);
//PdfPCell cellnew = new PdfPCell(); cellnew = new PdfPCell(new Phrase("*Indicates information supplied by the customer for which the laboratory has no control", smallFontBold)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_LEFT; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingTop = 0f; cellnew.PaddingBottom = .5f; cellnew.BorderWidth = 0f; tableScope10.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("Enclosures (" + dtTestReport.Rows[0]["ENCLOSURES"].ToString() + " )", smallFontBold)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_LEFT; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingTop = 3f; cellnew.PaddingBottom = .5f; cellnew.BorderWidth = 0f; tableScope10.AddCell(cellnew);
document.Add(tableScope10);
//document.Add(ParagraphNewLine);
//float[] columnDefinitionSize313 = { 100F }; //PdfPTable tableScope100 = new PdfPTable(columnDefinitionSize313); //tableScope100.WidthPercentage = 100;
//cellnew = new PdfPCell(new Phrase("", NormalFontTable)); //cellnew.ExtraParagraphSpace = 0f; //cellnew.HorizontalAlignment = Element.ALIGN_LEFT; //cellnew.VerticalAlignment = Element.ALIGN_CENTER; //cellnew.PaddingTop = 0f; //cellnew.PaddingBottom = .1f; //cellnew.BorderWidth = .1f; //cellnew.MinimumHeight = 20; //tableScope100.AddCell(cellnew); //document.Add(tableScope100);
float[] columnDefinitionSize315 = { 40F, 20f, 40f }; PdfPTable tableScope105 = new PdfPTable(columnDefinitionSize315); tableScope105.WidthPercentage = 100; tableScope105.KeepTogether = true;
cellnew = new PdfPCell(new Phrase(dtTestReport.Rows[0]["PreparedByVisible"].ToString() == "2" ? "Prepared By" : "", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_LEFT; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("Authorised Signatory", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; //cellnew.BorderWidthBottom = 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_LEFT; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; //cellnew.BorderWidthBottom = 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew); ////////////////////////
//iTextSharp.text.Image addPreparedBy = default(iTextSharp.text.Image); //addPreparedBy = iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath("~/App_Themes/Images/Sign_Shiv_29062020.png")); //addPreparedBy.ScaleAbsolute(100, 30);
//cellnew = new PdfPCell(addPreparedBy); //cellnew.ExtraParagraphSpace = 0f; //cellnew.HorizontalAlignment = Element.ALIGN_CENTER; //cellnew.VerticalAlignment = Element.ALIGN_CENTER; //cellnew.PaddingLeft = 25f; //cellnew.PaddingBottom = .8f; //cellnew.BorderWidth = 0f; //cellnew.BorderWidthBottom = 0.1f; //cellnew.MinimumHeight = 15; //tableScope105.AddCell(cellnew);
if (dtTestReport.Rows[0]["PreparedByVisible"].ToString() == "2") { cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .8f; cellnew.BorderWidth = 0f; cellnew.BorderWidthBottom = 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew); } else { cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .8f; cellnew.BorderWidth = 0f; cellnew.BorderWidthBottom = 0f;// 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew); }
if (!string.IsNullOrEmpty(dtTestReport.Rows[0]["FileName"].ToString()) && dtTestReport.Rows[0]["PreparedByVisible"].ToString() == "1" && chkWithSign.Checked) { iTextSharp.text.Image addAuthorisedBy = default(iTextSharp.text.Image); addAuthorisedBy = iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath("~/UserImage/" + dtTestReport.Rows[0]["FileName"].ToString())); addAuthorisedBy.ScaleAbsolute(100, 30);
cellnew = new PdfPCell(addAuthorisedBy); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .8f; cellnew.BorderWidth = 0f; cellnew.BorderWidthBottom = 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew); } else { cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .8f; cellnew.BorderWidth = 0f; cellnew.BorderWidthBottom = 0.1f; cellnew.MinimumHeight = 15; tableScope105.AddCell(cellnew); } /////////////////////// cellnew = new PdfPCell(new Phrase(dtTestReport.Rows[0]["PreparedByVisible"].ToString() == "2" ? dtTestReport.Rows[0]["PreparedBy"].ToString() : "", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase(dtTestReport.Rows[0]["AuthorisedName"].ToString(), NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
cellnew = new PdfPCell(new Phrase("(" + dtTestReport.Rows[0]["AuthorisedDesignation"].ToString() + ")", NormalFontTable)); cellnew.ExtraParagraphSpace = 0f; cellnew.HorizontalAlignment = Element.ALIGN_CENTER; cellnew.VerticalAlignment = Element.ALIGN_CENTER; cellnew.PaddingLeft = 25f; cellnew.PaddingBottom = .1f; cellnew.BorderWidth = 0f; tableScope105.AddCell(cellnew);
document.Add(tableScope105);
float[] columnDefinitionSize311 = { 80, 20 }; PdfPTable tableScope101 = new PdfPTable(columnDefinitionSize311); tableScope101.WidthPercentage = 100;
//cellnew = new PdfPCell(new Phrase("TC-8978", NormalFontTable)); //cellnew.ExtraParagraphSpace = 0f; //cellnew.HorizontalAlignment = Element.ALIGN_LEFT; //cellnew.VerticalAlignment = Element.ALIGN_LEFT; //cellnew.BorderWidth = 0f; //tableScope101.AddCell(cellnew); //document.Add(tableScope101);
////////////////////////////////////////////////////////////////////////////
document.Close(); Suffix = "/1"; try { SyncFile(pdfFileName, pdf_fileName, LabID, UfileName, obj.ToString()); } catch (Exception ex) { } }
// }
catch (Exception ex) {
} } try { using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) { zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.AsNecessary; zip.AddDirectoryByName(fileName); foreach (string file in filelist) { if (!string.IsNullOrEmpty(file)) { zip.AddFile(file, fileName); } } Response.Clear(); Response.BufferOutput = false; string zipName = String.Format(fileName + ".zip"); Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "attachment; filename=" + zipName); zip.Save(Response.OutputStream); Response.End(); } } catch (Exception ex) {
} }
thisis my portrait mode