示例#1
0
        public void InsertData(List <ClientPartReport> result, Aspose.Words.Tables.Table myTable, Aspose.Words.DocumentBuilder builder)
        {
            string partLink   = string.Empty;
            string strLiveURL = System.Configuration.ConfigurationManager.AppSettings["LiveSiteURL"].ToString();

            // string[] ColName = { "Part No", "Day", "Records Of","Location", "Client Matter", "Claim No", "Note" };
            foreach (ClientPartReport item in result)
            {
                Row clonedRow = (Row)myTable.FirstRow.Clone(true);

                // clonedRow.Cells[0].CellFormat.Width = 100;
                partLink = strLiveURL + "/" + "PartDetail?OrderId=" + item.OrderNo + "&PartNo=" + item.PartNo;

                clonedRow.Cells[0].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[0].FirstParagraph);
                builder.Font.Color = Color.OrangeRed;
                // builder.Font.Underline = Underline.Single;

                builder.InsertHyperlink(item.OrderPart, partLink, false);
                // builder.InsertField(@"HYPERLINK " +  partLink + "\t_blank", item.OrderPart);

                builder.Font.ClearFormatting();

                // clonedRow.Cells[1].CellFormat.Width = 50;
                clonedRow.Cells[1].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[1].FirstParagraph);
                builder.Write(item.OrderDays.ToString());

                clonedRow.Cells[2].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[2].FirstParagraph);
                builder.Write(item.RecordsOf);

                clonedRow.Cells[3].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[3].FirstParagraph);
                builder.Write(item.Location);

                clonedRow.Cells[4].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[4].FirstParagraph);
                builder.Write(item.ClaimMatterNo);

                clonedRow.Cells[5].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[5].FirstParagraph);
                builder.Write(item.BillingClaimNo);

                clonedRow.Cells[6].FirstParagraph.ChildNodes.Clear();
                builder.MoveTo(clonedRow.Cells[6].FirstParagraph);
                builder.Write(item.Note);


                myTable.AppendChild(clonedRow);
            }
            builder.InsertBreak(BreakType.PageBreak);
        }