当前位置: 首页>>代码示例>>C#>>正文


C# TableRow.AppendChild方法代码示例

本文整理汇总了C#中TableRow.AppendChild方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.AppendChild方法的具体用法?C# TableRow.AppendChild怎么用?C# TableRow.AppendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TableRow的用法示例。


在下文中一共展示了TableRow.AppendChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DownloadDoc

        public void DownloadDoc(string id)
        {
            OutgoingNotice notice = repository.FindByNotCache(id);
            if (notice == null)
            {
                Response.Write("无法找到指定的发料通知单");
            }

            String templateDir = Server.MapPath("~/Report/Template/Outgoing/");
            String templateFile = "单根检验信息.docx";

            FileInfo fi = new FileInfo(templateDir + templateFile);
            if (!fi.Exists)
            {
                throw new FileNotFoundException("模板文件(" + templateFile + ")不存在,请联系系统管理员");
            }

            string desDir = Server.MapPath("~/Report/Output/NormalCheck/");
            string desFileName = string.Format("发料单单根检测信息统计表({0}){1}.docx", notice.Key, DateTime.Now.ToString("yyyyMMddHHmmssffff"));

            DirectoryInfo di = new DirectoryInfo(desDir);
            if (!di.Exists) { di.Create(); }
            fi.CopyTo(desDir + desFileName);

            #region Create Documnent

            using (WordprocessingDocument doc = WordprocessingDocument.Open(desDir + desFileName, true, new OpenSettings { AutoSave = true }))
            {
                doc.MainDocumentPart.Document.Body.Descendants<Paragraph>().FirstOrDefault().Remove();

                int i = 0;
                int itemsPerPage = 25;
                int recordsPageCount = notice.Records.Count / itemsPerPage;
                if (notice.Records.Count % itemsPerPage != 0) { recordsPageCount += 1; }
                recordsPageCount += 1;
                int curPage = 0;
                float length = 0;

                Table table = null;
                NormalCheckRecord ncRecord = null;

                INormalCheckRecordRepository ncRecordRepository = RepositoryFactory.GetRepository<INormalCheckRecordRepository, NormalCheckRecord>();

                foreach (PipeOutgoingRecord r in notice.Records.OrderBy(por => por.Pipe == null ? string.Empty : por.Pipe.Code))
                {
                    ncRecord = ncRecordRepository.FindBy(r.Pipe).FirstOrDefault();

                    length += Convert.ToSingle(r.Pipe.WorkLength.Value.ToString());
                    length=Convert.ToSingle(Math.Round(length, 2));

                    if (i % itemsPerPage == 0)
                    {
                        if (i != 0)
                        {
                            doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateBreakPageParagraph());
                        }

                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataHeadParagraph());

                        table = GenerateBasiceReportDataTable();

                        #region 表头

                        table.Elements<TableRow>().First().Remove();
                        TableRow row1 = new TableRow();
                        TableRow row2 = new TableRow();

                        row1.AppendChild<TableCell>(BuildCell("单根编号", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        row1.Append(BuildCell(notice.PipeType.Name, 5, null, true));
                        row2.Append(BuildCell("外径(mm)", 1, null, true));
                        row2.Append(BuildCell("钢 级", 1, null, true));
                        row2.Append(BuildCell("壁厚("+notice.PipeType.ThicknessUnit+")", 1, null, true));
                        row2.Append(BuildCell("螺 纹", 1, null, true));
                        row2.Append(BuildCell("长度(m)", 1, null, true));

                        row1.Append(BuildCell("外 观 检 查", 4, null, true));
                        row2.Append(BuildCell("管 体", 1, null, true));
                        row2.Append(BuildCell("管 端", 1,null, true));
                        row2.Append(BuildCell("螺 纹", 1, null, true));
                        row2.Append(BuildCell("直 度", 1, null, true));

                        row1.AppendChild<TableCell>(BuildCell("通径("+notice.PipeType.UnBlockStandard+notice.PipeType.UnBlockUnit+")", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        row1.AppendChild<TableCell>(BuildCell("管体探伤", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        //row1.AppendChild<TableCell>(BuildCell("盲区探伤", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        //row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        //if (ncRecord.NormalCheckTask.IsCheckPressure.HasValue && ncRecord.NormalCheckTask.IsCheckPressure.Value)
                        //{
                            row1.AppendChild<TableCell>(BuildCell("试压(" + notice.PipeType.PressureDetectUnit + ")", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                            row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));
                        //}

                        //if (ncRecord.NormalCheckTask.IsCheckCloseness.HasValue && ncRecord.NormalCheckTask.IsCheckCloseness.Value)
                        //{
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:101,代码来源:OutgoingNoticeController.cs

示例2: DownloadReportDoc


//.........这里部分代码省略.........

                row = table.Elements<TableRow>().ElementAt(10);
                t = row.Elements<TableCell>().ElementAt(1).Elements<Paragraph>().First().Elements<Run>().First().Elements<Text>().First();
                t.Text = task.ReportComment; // 检测项目

                #endregion

                Dictionary<string, Producer> producers = new Dictionary<string, Producer>();

                #region 检测结果表格

                //TableCell cell = null;
                //TableCellProperties cellProperty = null;
                PipeType pt = task.PipeType;
                int i = 0;
                int recordsPageCount = task.Count.Value / 40;
                if (task.Count.Value % 40 != 0) { recordsPageCount += 1; }
                recordsPageCount += 1;

                texts = doc.MainDocumentPart.Document.Descendants<Text>().Where(text => text.Text == "totalPageCount");
                foreach (Text text in texts)
                {
                    text.Text = recordsPageCount.ToString();
                }

                doc.MainDocumentPart.Document.Body.Elements<Paragraph>().Last().Remove();

                foreach (NormalCheckRecord r in task.Records)
                {
                    if (i % 40 == 0)
                    {
                        if (i != 0)
                        {
                            doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateBreakPageParagraph());
                        }

                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataHeadParagraph());
                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataSecondHeadParagraph("WZSYS-" + task.Company.Code.ToString() + "-" + task.ReportNO,
                            string.Format("{0}x{1} {2} {3}", pt.ExternalDiameter, pt.Thickness, pt.SteelLevel, pt.Screw),
                            i / 40 + 1 + 1, recordsPageCount, string.Format(task.WorkNO)));

                        table = GenerateBasiceReportDataTable();

                        #region 表头

                        table.Elements<TableRow>().First().Remove();

                        TableRow row1 = new TableRow();
                        row1.Append(BuildCell("子样号", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));

                        TableRow row2 = new TableRow();
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        TableRow row3 = new TableRow();
                        row3.Append(BuildCell("标准范围"));

                        if (task.IsNeedWash.HasValue && task.IsNeedWash.Value)
                        {
                            row1.Append(BuildCell("外径(mm)", 2, null, true));
                            row2.Append(BuildCell("最大值", 1, null, true));
                            row2.Append(BuildCell("最小值", 1, null, true));

                            string str = pt.StraightStandard.ToString();
                            int nIndex;
                            string wMin;
                            string wMax;
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:67,代码来源:NormalCheckTaskController.cs

示例3: DownloadDoc

        //[LoginFilter(Order = 0)]
        //[SecurityFilter(Order = 1)]
        // 下载回收油套管明细表
        public void DownloadDoc(string id)
        {
            ReturningNotice notice = repository.FindByNotCache(id);
            Account onlineAccount = UserSession.OnlineAccount;
            if (notice == null)
            {
                Response.Write("无法找到指定的发料通知单");
            }

            String templateDir = Server.MapPath("~/Report/Template/Returning/");
            String templateFile = "回收油套管明细表.docx";

            FileInfo fi = new FileInfo(templateDir + templateFile);
            if (!fi.Exists)
            {
                throw new FileNotFoundException("模板文件(" + templateFile + ")不存在,请联系系统管理员");
            }

            string desDir = Server.MapPath("~/Report/Output/Returning/");
            string desFileName = string.Format("回收油套管明细{0}表{1}.docx", notice.Key, DateTime.Now.ToString("yyyyMMddHHmmssffff"));

            DirectoryInfo di = new DirectoryInfo(desDir);
            if (!di.Exists) { di.Create(); }
            fi.CopyTo(desDir + desFileName);

            #region Create Documnent

            using (WordprocessingDocument doc = WordprocessingDocument.Open(desDir + desFileName, true, new OpenSettings { AutoSave = true }))
            {
                doc.MainDocumentPart.Document.Body.Descendants<Paragraph>().FirstOrDefault().Remove();

                int i = 0;
                int itemsPerPage = 25;
                int recordsPageCount = notice.Records.Count / itemsPerPage;
                if (notice.Records.Count % itemsPerPage != 0) { recordsPageCount += 1; }
                recordsPageCount += 1;
                //int curPage = 0;
                float length = 0;

                PipeType pipetype = null;

                IPipeTypeRepository PipeTypeRepository = RepositoryFactory.GetRepository<IPipeTypeRepository, PipeType>();

                string currentDigger = string.Empty;
                Table table = null;
                string instruction = notice.Instruction;

                foreach (PipeReturningRecord r in notice.Records.OrderBy(por => por.DiggerName))
                {
                    pipetype = PipeTypeRepository.FindById(r.Pipe);

                    length += Convert.ToSingle(r.Pipe.WorkLength.Value.ToString());
                    length = Convert.ToSingle(Math.Round(length, 2));

                    if (r.DiggerName != currentDigger)
                    {
                        table = new Table();
                        i = 0;

                        if (currentDigger != string.Empty)
                        {
                            doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateLastParagraph(instruction));

                            doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateBreakPageParagraph());
                        }
                        currentDigger = r.DiggerName;

                        string digger = r.DiggerName.ToString();
                        string a = r.ReturningNotice.Key.ToString().Substring(0,2);
                        DataTable dt=RepositoryFactory.GetRepository<IDetectionCompanyRepository, DetectionCompany>().company(a);
                        string company = dt.Rows[0]["name"].ToString();
                        //string company = onlineAccount.DetectionCompany.Name.ToString();
                        string date = r.DateCreated.ToString("yyyy-MM-dd");
                        string code = r.ReturningNotice.Key.ToString();

                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataHeadParagraph(digger));

                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateLastParagraph(company, date, code));

                        table = GenerateBasiceReportDataTable();

                        #region 表头

                        table.Elements<TableRow>().First().Remove();
                        TableRow row1 = new TableRow();
                        TableRow row2 = new TableRow();

                        row1.AppendChild<TableCell>(BuildCell("序号", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        row1.AppendChild<TableCell>(BuildCell("自编号", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        row1.AppendChild<TableCell>(BuildCell("规格", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        row1.AppendChild<TableCell>(BuildCell("纲级", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true));
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:101,代码来源:ReturningNoticeController.cs

示例4: InsertRow

        /// <summary>
        /// Add a row to this class.
        /// </summary>
        /// <param name="rowProperties">The properties for row to add.</param>
        /// <param name="rowIndex">The index of the row to add.</param>
        public void InsertRow(string rowProperties, int rowIndex)
        {
            int cellCount = this.LastRow.Cells.Count;
            TableRow row = new TableRow();
            row.TableRowProperties = new TableRowProperties(rowProperties);
            this.Rows[rowIndex - 1].Row.InsertAfterSelf<TableRow>(row);
            this.Rows.Insert(rowIndex, new TableRowInfo(row));

            for (int i = 0; i < cellCount; i++)
            {
                row.AppendChild<TableCell>(this.Rows[rowIndex].AddCell(new TableCell())).AppendChild<Paragraph>(new Paragraph());
            }
        }
开发者ID:PeterLaudy,项目名称:Open-XML-DocxGenerator,代码行数:18,代码来源:TableInfo.cs

示例5: DownloadReportDoc


//.........这里部分代码省略.........
                #endregion

                #endregion

                #region 检测结果表格

                TableCell cell = null;
                //TableCellProperties cellProperty = null;

                PipeType pt = notice.PipeType;

                #region 检测数据

                int i = 0;
                int recordsPageCount = notice.SamplingCount.Value / 20;
                if (notice.SamplingCount.Value % 20 != 0) { recordsPageCount += 1; }

                recordsPageCount += 1;

                texts = doc.MainDocumentPart.Document.Descendants<Text>().Where(text => text.Text == "Count");
                foreach (Text text in texts)
                {
                    text.Text = recordsPageCount.ToString();
                }

                doc.MainDocumentPart.Document.Body.Elements<Paragraph>().Last().Remove();

                foreach (PipeBCRecord record in RepositoryFactory.GetRepository<IPipeBCRecordRepository, PipeBCRecord>().FindBy(notice))
                {
                    if (i % 20 == 0) // 每页20条
                    {
                        if (i != 0)
                        {
                            doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateBreakPageParagraph());
                        }

                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataHeadParagraph());
                        doc.MainDocumentPart.Document.Body.AppendChild<Paragraph>(GenerateReportDataSecondHeadParagraph(notice.ReportNumber,
                            string.Format("{0}x{1} {2} {3}", notice.PipeType.ExternalDiameter, notice.PipeType.Thickness, notice.PipeType.SteelLevel, notice.PipeType.Screw),
                            i / 20 + 1 + 1, recordsPageCount));

                        table = GenerateBasiceReportDataTable();

                        #region 表头

                        row = table.Elements<TableRow>().First();
                        row.Elements<TableCell>().First().Remove();

                        cell = BuildCell("抽样号", 1, new VerticalMerge { Val = MergedCellValues.Restart }, true);

                        //cellProperty = cell.Elements<TableCellProperties>().First();
                        //cellProperty.Append(new TableCellWidth { Width = "40", Type = TableWidthUnitValues.Pct });
                        row.AppendChild<TableCell>(cell);

                        TableRow row2 = new TableRow();
                        row2.Append(BuildCell(string.Empty, 1, new VerticalMerge()));

                        TableRow row3 = new TableRow();
                        //TableCellProperties cellProperty3 = new TableCellProperties();
                        //cellProperty3.Append(new TableCellWidth { Width = "40", Type = TableWidthUnitValues.Dxa });
                        row3.Append(BuildCell("标准范围"));
                        //row3.Elements<TableCell>().ElementAt(0).Append(cellProperty3);

                        if (pt.OtherCheckItems != null)
                        {
                            foreach (ICheckItemBase item in pt.OtherCheckItems.CheckItems)
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:67,代码来源:BusinessCheckNoticeController.cs

示例6: CreateRow

        //This method allows me to create either a row full of text cells or a row of text cells and a last row with a drawing
        TableRow CreateRow(string[] cellText)
        {
            TableRow tr = new TableRow();

            //create cells with simple text
            foreach (string s in cellText) {
                TableCell tc = new TableCell();
                Paragraph p = new Paragraph();
                Run r = new Run();
                Text t = new Text(s);

                r.AppendChild(t);
                p.AppendChild(r);
                tc.AppendChild(p);
                tr.AppendChild(tc);
            }

            return tr;
        }
开发者ID:garsiden,项目名称:Report-Generator,代码行数:20,代码来源:Program.cs


注:本文中的TableRow.AppendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。