protected WordDocumentWriter GetWordDocumentWriter(string fullPath)
        {
            WordDocumentWriter docWriter;

            try
            {
                docWriter = WordDocumentWriter.Create(fullPath);

                docWriter.DefaultParagraphProperties.Alignment = ParagraphAlignment.Left;
                docWriter.Unit = UnitOfMeasurement.Centimeter;

                docWriter.FinalSectionProperties.PageSize     = new Size(21.0, 29.7);
                docWriter.FinalSectionProperties.PageMargins  = new Padding(2.5f, 1.5f, 1.3f, 1.5f);
                docWriter.FinalSectionProperties.FooterMargin = 0.7f;

                docWriter.DocumentProperties.Author  = GlobalAppProperties.User.Employee.Person.ToString();
                docWriter.DocumentProperties.Company = "УЭТМ";
            }
            catch (IOException e)
            {
                MessageService.ShowOkMessageDialog(e.GetType().Name, e.Message);
                return(null);
            }

            return(docWriter);
        }
        /// <summary>
        /// Печать технических деталей ТКП
        /// </summary>
        /// <param name="docWriter"></param>
        /// <param name="offerUnitsGroupsByFacilities"></param>
        private void PrintTechnicalDetails(WordDocumentWriter docWriter, List <IGrouping <Facility, OfferUnitsGroup> > offerUnitsGroupsByFacilities)
        {
            var paragraphProperties = docWriter.CreateParagraphProperties();

            paragraphProperties.PageBreakBefore = true;

            Font fontHeader = docWriter.CreateFont();

            fontHeader.Bold = true;

            docWriter.PrintParagraph("Технические характеристики оборудования(в соответствии с позициями таблицы):", paragraphProperties, fontHeader);
            int positionNumber = 1;

            foreach (var offerUnitsGroupsByFacility in offerUnitsGroupsByFacilities)
            {
                foreach (var offerUnitsGroup in offerUnitsGroupsByFacility)
                {
                    docWriter.PrintParagraph($"{positionNumber++}. {offerUnitsGroup.Product} = {offerUnitsGroupsByFacility.Count()} шт.:");
                    _printProductService.Print(docWriter, offerUnitsGroup.Product.Model);

                    // включенное в состав оборудование
                    if (offerUnitsGroup.ProductsIncluded.Any())
                    {
                        docWriter.PrintParagraph("Дополнительное оборудование, включенное в состав:");
                        foreach (var productIncluded in offerUnitsGroup.ProductsIncluded)
                        {
                            docWriter.PrintParagraph($"{productIncluded.Model.Product} {productIncluded.Model.Amount} шт.:");
                            _printProductService.Print(docWriter, productIncluded.Model.Product);
                        }
                    }

                    docWriter.PrintParagraph(Environment.NewLine);
                }
            }
        }
Exemple #3
0
        public void PrintProducts(IEnumerable <Product> products, ProductBlock block = null)
        {
            try
            {
                var pathDocx = AppDomain.CurrentDomain.BaseDirectory + $"\\{Guid.NewGuid()}.docx";
                WordDocumentWriter docWriter = WordDocumentWriter.Create(pathDocx);
                docWriter.StartDocument();

                foreach (var product in products)
                {
                    docWriter.PrintParagraph($"{product}");
                    Print(docWriter, product, null, block);

                    var paragraphProperties = docWriter.CreateParagraphProperties();
                    paragraphProperties.PageBreakBefore = true;
                    docWriter.PrintParagraph(string.Empty, paragraphProperties);
                }


                docWriter.EndDocument();
                docWriter.Close();

                //var pathPdf = AppDomain.CurrentDomain.BaseDirectory + @"\ProductsDocument.pdf";
                //var documentCore = DocumentCore.Load(pathDocx);
                //documentCore.Save(pathPdf, SaveOptions.PdfDefault);

                System.Diagnostics.Process.Start(pathDocx);
                //System.Diagnostics.Process.Start(pathPdf);
            }
            catch (IOException ioException)
            {
                _container.Resolve <IMessageService>().ShowOkMessageDialog("Ошибка", ioException.PrintAllExceptions());
            }
        }
        protected TableBorderProperties GetTableBorderProperties(WordDocumentWriter docWriter)
        {
            var borderProps = docWriter.CreateTableBorderProperties();

            borderProps.Color = Colors.Black;
            borderProps.Style = TableBorderStyle.Single;
            return(borderProps);
        }
 public static WordDocumentWriter PrintTableCell(this WordDocumentWriter docWriter, string text,
                                                 TableCellProperties cellProperties = null, ParagraphProperties paragraphProperties = null, Font font = null)
 {
     cellProperties = cellProperties ?? docWriter.CreateTableCellProperties();
     docWriter.StartTableCell(cellProperties);
     docWriter.PrintParagraph(text, paragraphProperties, font);
     docWriter.EndTableCell();
     return(docWriter);
 }
        protected TableProperties GetTableProperties(WordDocumentWriter docWriter, TableBorderProperties borderProps)
        {
            var tableProps = docWriter.CreateTableProperties();

            tableProps.Alignment = ParagraphAlignment.Left;
            tableProps.BorderProperties.Color = borderProps.Color;
            tableProps.BorderProperties.Style = borderProps.Style;
            return(tableProps);
        }
 private static void PrintSumTableString(string text, double sum, WordDocumentWriter docWriter, TableCellProperties tableCellProperties,
                                         Font font, ParagraphProperties parProp)
 {
     docWriter.StartTableRow();
     tableCellProperties.ColumnSpan = 5;
     docWriter.PrintTableCell(text, tableCellProperties, null, font);
     tableCellProperties.ColumnSpan = 1;
     docWriter.PrintTableCell($"{sum:N}", tableCellProperties, parProp, font);
     docWriter.EndTableRow();
 }
Exemple #8
0
            private void AddTableCell(WordDocumentWriter documentWriter, TableCellProperties cellProperties, string cellText)
            {
                // Start a Cell
                documentWriter.StartTableCell(cellProperties);

                // Start a Paragraph and add a text run to the cell
                documentWriter.StartParagraph();
                documentWriter.AddTextRun(cellText);
                documentWriter.EndParagraph();

                // End the Cell
                documentWriter.EndTableCell();
            }
Exemple #9
0
        public void PrintProduct(Product product)
        {
            string             offerDocumentPath = AppDomain.CurrentDomain.BaseDirectory + "\\TestProductDocument.docx";
            WordDocumentWriter docWriter         = WordDocumentWriter.Create(offerDocumentPath);

            docWriter.StartDocument();
            docWriter.PrintParagraph($"{product}");

            Print(docWriter, product);

            docWriter.EndDocument();
            docWriter.Close();
            System.Diagnostics.Process.Start(offerDocumentPath);
        }
Exemple #10
0
        public void Print(WordDocumentWriter docWriter, Product product, int?amount = null, ProductBlock block = null)
        {
            var tableProperties = docWriter.CreateTableProperties();

            tableProperties.Alignment = ParagraphAlignment.Left;
            tableProperties.PreferredWidthAsPercentage = 100;
            //выделяем необходимый блок
            if (block != null && product.ProductBlock.Id == block.Id)
            {
                tableProperties.BorderProperties.Color = Colors.Red;
                tableProperties.BorderProperties.Width = 3;
            }
            docWriter.StartTable(2, tableProperties);

            //Заголовок
            docWriter.StartTableRow();
            Font fontBold = docWriter.CreateFont();

            fontBold.Bold = true;
            var header = amount == null ? $"{product}" : $"{product} x {amount} шт.";

            docWriter.PrintTableCell(header, docWriter.CellProps(2, null, Colors.AliceBlue), null, fontBold);
            docWriter.EndTableRow();

            //строки параметров
            foreach (var parameter in product.ProductBlock.GetOrderedParameters())
            {
                docWriter.StartTableRow();
                docWriter.PrintTableCell($"{parameter.ParameterGroup}");
                docWriter.PrintTableCell($"{parameter}");
                docWriter.EndTableRow();
            }

            //печать зависимого оборудования
            foreach (var dependent in product.DependentProducts)
            {
                docWriter.StartTableRow();
                docWriter.StartTableCell(docWriter.CellProps(2, Padding.PadAll(0.25f)));
                Print(docWriter, dependent.Product, dependent.Amount, block);
                docWriter.EndTableCell();
                docWriter.EndTableRow();
            }

            docWriter.EndTable();
        }
        public static WordDocumentWriter PrintTableRow(this WordDocumentWriter docWriter, TableCellProperties cellProps,
                                                       TableRowProperties tableRowProperties = null, ParagraphProperties paragraphProperties = null, Font font = null,
                                                       params string[] text)
        {
            if (tableRowProperties == null)
            {
                docWriter.StartTableRow();
            }
            else
            {
                docWriter.StartTableRow(tableRowProperties);
            }

            text.ForEach(x => docWriter.PrintTableCell(x, cellProps, paragraphProperties, font));

            docWriter.EndTableRow();
            return(docWriter);
        }
        public static TableCellProperties CellProps(this WordDocumentWriter docWriter, int?span = null, Padding?margin = null, Color?color = null)
        {
            var tableCellProperties = docWriter.CreateTableCellProperties();

            if (span.HasValue)
            {
                tableCellProperties.ColumnSpan = span.Value;
            }
            if (margin.HasValue)
            {
                tableCellProperties.Margins = margin.Value;
            }
            if (color.HasValue)
            {
                tableCellProperties.BackColor = color.Value;
            }
            return(tableCellProperties);
        }
        /// <summary>
        /// Печать параграфа.
        /// </summary>
        /// <param name="docWriter"></param>
        /// <param name="text">Текст.</param>
        /// <param name="paragraphProperties"></param>
        /// <param name="font"></param>
        public static void PrintParagraph(this WordDocumentWriter docWriter, string text, ParagraphProperties paragraphProperties = null, Font font = null)
        {
            text = text ?? string.Empty;

            if (paragraphProperties == null)
            {
                docWriter.StartParagraph();
            }
            else
            {
                docWriter.StartParagraph(paragraphProperties);
            }

            if (font == null)
            {
                docWriter.AddTextRun(text);
            }
            else
            {
                docWriter.AddTextRun(text, font);
            }

            docWriter.EndParagraph();
        }
Exemple #14
0
 public WordExportingModel()
 {
     memStream  = new MemoryStream();
     wordWriter = WordDocumentWriter.Create(memStream);
 }
Exemple #15
0
 public WordExportingModel(MemoryStream ms)
 {
     memStream  = ms;
     wordWriter = WordDocumentWriter.Create(memStream);
 }
            private void AddTableCell(WordDocumentWriter documentWriter, TableCellProperties cellProperties, string cellText)
            {
                // Start a Cell
                documentWriter.StartTableCell(cellProperties);

                // Start a Paragraph and add a text run to the cell
                documentWriter.StartParagraph();
                documentWriter.AddTextRun(cellText);
                documentWriter.EndParagraph();

                // End the Cell
                documentWriter.EndTableCell();
            }
 public WordExportingModel(MemoryStream ms)
 {
     memStream = ms;
     wordWriter = WordDocumentWriter.Create(memStream);
 }
 public WordExportingModel()
 {
     memStream = new MemoryStream();
     wordWriter = WordDocumentWriter.Create(memStream);
 }
Exemple #19
0
        private static MemoryStream CreateWord()
        {
            //	private static MemoryStream CreateExcel(METTLib.Questionnaire.QuestionnaireAnswerExportSetList QuestionnaireAnswerExportSetList)
            //public void CreateWord()
            //{
            //	//Create a new instance of the WordDocumentWriter class
            MemoryStream m = new MemoryStream();


            WordDocumentWriter docWriter = WordDocumentWriter.Create(m);

            docWriter.Unit = UnitOfMeasurement.Point;

            docWriter.DocumentProperties.Title  = "METT - Intervention Report";
            docWriter.DocumentProperties.Author = string.Format("Singular Systems", "");
            docWriter.StartDocument();

            Infragistics.Documents.Word.Font fontHeading = docWriter.CreateFont();
            fontHeading.Name = "Arial";
            fontHeading.Size = 22;
            fontHeading.Bold = true;

            Infragistics.Documents.Word.Font fontSubHeading = docWriter.CreateFont();
            fontSubHeading.Name = "Arial";
            fontSubHeading.Size = 16;
            fontSubHeading.Bold = true;

            Infragistics.Documents.Word.Font fontNormal = docWriter.CreateFont();
            fontNormal.Name = "Arial";
            fontNormal.Size = 9;
            fontNormal.Bold = false;

            Infragistics.Documents.Word.Font fontBold = docWriter.CreateFont();
            fontBold.Name = "Arial";
            fontBold.Size = 9;
            fontBold.Bold = true;

            Infragistics.Documents.Word.Font fontBoldLarge = docWriter.CreateFont();
            fontBoldLarge.Name = "Arial";
            fontBoldLarge.Size = 11;
            fontBoldLarge.Bold = true;

            Infragistics.Documents.Word.Font fontSmall = docWriter.CreateFont();
            fontSmall.Name = "Arial";
            fontSmall.Size = 8;
            fontSmall.Bold = false;

            docWriter.StartParagraph();
            docWriter.AddTextRun("Intervention Report", fontHeading);
            docWriter.EndParagraph();

            docWriter.StartParagraph();
            docWriter.AddTextRun("", fontHeading);
            docWriter.EndParagraph();

            //Specify the default parts for header and footer
            SectionHeaderFooterParts     parts     = SectionHeaderFooterParts.HeaderAllPages | SectionHeaderFooterParts.FooterAllPages;
            SectionHeaderFooterWriterSet writerSet = docWriter.AddSectionHeaderFooter(parts);

            //Set text for Header
            writerSet.HeaderWriterAllPages.Open();
            writerSet.HeaderWriterAllPages.StartParagraph();
            writerSet.HeaderWriterAllPages.AddTextRun("Management Effectiveness Tracking Tool-South Africa (METT) - Intervention Report [Protected Area]", fontSmall);
            writerSet.HeaderWriterAllPages.EndParagraph();
            writerSet.HeaderWriterAllPages.Close();
            // Set text for Footer
            writerSet.FooterWriterAllPages.Open();
            writerSet.FooterWriterAllPages.StartParagraph();
            writerSet.FooterWriterAllPages.AddTextRun("[This report was generated on " + DateTime.Now.ToString("dd/MM/yyyy") + "]", fontSmall);
            writerSet.FooterWriterAllPages.EndParagraph();
            writerSet.FooterWriterAllPages.Close();

            // MANAGEMENT SPHERES SUMMARY SECTION
            // **********************************
            docWriter.StartParagraph();
            docWriter.AddTextRun("Management Sphere Summary", fontSubHeading);
            docWriter.EndParagraph();

            docWriter.StartParagraph();
            docWriter.AddTextRun("", fontHeading);
            docWriter.EndParagraph();

            TableBorderProperties borderProps = docWriter.CreateTableBorderProperties();

            borderProps.Color = Color.Black;
            borderProps.Style = TableBorderStyle.Double;
            TableProperties tableProps = docWriter.CreateTableProperties();

            tableProps.Layout = TableLayout.Fixed;
            tableProps.PreferredWidthAsPercentage = 100;
            tableProps.Alignment = ParagraphAlignment.Center;
            tableProps.BorderProperties.Color = borderProps.Color;
            tableProps.BorderProperties.Style = borderProps.Style;
            TableRowProperties rowProps = docWriter.CreateTableRowProperties();

            rowProps.IsHeaderRow = true;
            TableCellProperties cellProps = docWriter.CreateTableCellProperties();

            var ROManagementSphereList = METTLib.Reports.ROManagementSphereList.GetROManagementSphereList();

            foreach (var sphereitem in ROManagementSphereList)
            {
                cellProps.BackColor     = Color.DarkGray;
                cellProps.TextDirection = TableCellTextDirection.LeftToRightTopToBottom;

                docWriter.StartTable(1, tableProps);
                docWriter.StartTableRow(rowProps);
                docWriter.StartTableCell(cellProps);

                docWriter.StartParagraph();
                docWriter.AddTextRun("");
                docWriter.EndParagraph();

                docWriter.StartParagraph();
                docWriter.AddTextRun(sphereitem.ManagementSphereID + ". " + sphereitem.ManagementSphere, fontBoldLarge);
                docWriter.EndParagraph();

                docWriter.StartParagraph();
                docWriter.AddTextRun(sphereitem.ManagementSphereContent, fontNormal);
                docWriter.EndParagraph();

                docWriter.StartParagraph();
                docWriter.AddTextRun("");
                docWriter.EndParagraph();

                docWriter.EndTableCell();
                docWriter.EndTableRow();
                docWriter.EndTable();

                docWriter.StartParagraph();
                docWriter.AddTextRun("");
                docWriter.EndParagraph();

                docWriter.StartTable(3, tableProps);
                docWriter.StartTableRow(rowProps);

                cellProps.PreferredWidthAsPercentage = 70;
                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Indicators");
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                cellProps.PreferredWidthAsPercentage = 15;
                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Value");
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                cellProps.PreferredWidthAsPercentage = 15;
                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Rating (as %)");
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                docWriter.EndTableRow();

                cellProps.Reset();
                cellProps.BackColor = Color.White;

                docWriter.EndTable();

                docWriter.StartTable(3, tableProps);

                int     dTotalValue  = 0;
                int     dTotalRating = 0;
                decimal dTotalPerc   = 0;

                var ReportInterventionManagementSphereList = METTLib.Reports.ReportInterventionManagementSphereList.GetReportInterventionManagementSphereList(284, sphereitem.ManagementSphereID);
                foreach (var item in ReportInterventionManagementSphereList)
                {
                    dTotalValue  = dTotalValue + item.MaxValue;
                    dTotalRating = dTotalRating + item.AnswerRating;

                    docWriter.StartTableRow();

                    docWriter.StartTableCell(cellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(item.IndicatorDetailName, fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    docWriter.StartTableCell(cellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(Convert.ToString(item.MaxValue), fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    if (item.AnswerRating == 0)
                    {
                        cellProps.BackColor = Color.Red;
                    }
                    if (item.AnswerRating == 1)
                    {
                        cellProps.BackColor = Color.Yellow;
                    }
                    if (item.AnswerRating == 2)
                    {
                        cellProps.BackColor = Color.Yellow;
                    }
                    if (item.AnswerRating == 3)
                    {
                        cellProps.BackColor = Color.LightGreen;
                    }

                    docWriter.StartTableCell(cellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(Convert.ToString(item.AnswerRating), fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    cellProps.Reset();
                    cellProps.BackColor = Color.White;

                    docWriter.EndTableRow();
                }

                docWriter.StartTableRow();

                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Total", fontBold);
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun(Convert.ToString(dTotalValue), fontBold);
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                if (dTotalRating > 0)
                {
                    if (dTotalValue > 0)
                    {
                        dTotalPerc = Math.Round((Convert.ToDecimal(dTotalRating) / Convert.ToDecimal(dTotalValue)) * 100, 2);
                    }
                    else
                    {
                        dTotalPerc = 0;
                    }
                }
                else
                {
                    dTotalPerc = 0;
                }

                docWriter.StartTableCell(cellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun(Convert.ToString(dTotalPerc), fontBold);
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                docWriter.EndTableRow();

                docWriter.EndTable();
                docWriter.StartParagraph();
                docWriter.AddTextRun("", fontHeading);
                docWriter.EndParagraph();
                docWriter.StartParagraph();
                docWriter.AddTextRun("", fontHeading);
                docWriter.EndParagraph();
            }

            docWriter.StartParagraph();
            docWriter.AddTextRun("", fontHeading);
            docWriter.EndParagraph();

            docWriter.StartParagraph();
            docWriter.AddTextRun("");
            docWriter.EndParagraph();

            // NEXT STEPS REPORT SECTION
            // *************************

            docWriter.StartParagraph();
            docWriter.AddTextRun("Next Steps Summary", fontSubHeading);
            docWriter.EndParagraph();

            docWriter.StartParagraph();
            docWriter.AddTextRun("", fontHeading);
            docWriter.EndParagraph();

            TableBorderProperties NextStepsborderProps = docWriter.CreateTableBorderProperties();

            NextStepsborderProps.Color = Color.Black;
            NextStepsborderProps.Style = TableBorderStyle.Double;

            TableProperties NextStepstableProps = docWriter.CreateTableProperties();

            NextStepstableProps.Layout = TableLayout.Fixed;
            NextStepstableProps.PreferredWidthAsPercentage = 100;
            NextStepstableProps.Alignment = ParagraphAlignment.Left;
            NextStepstableProps.BorderProperties.Color = borderProps.Color;
            NextStepstableProps.BorderProperties.Style = borderProps.Style;
            TableRowProperties NextStepsrowProps = docWriter.CreateTableRowProperties();

            rowProps.IsHeaderRow = true;
            TableCellProperties NextStepscellProps = docWriter.CreateTableCellProperties();

            NextStepscellProps.BackColor     = Color.DarkGray;
            NextStepscellProps.TextDirection = TableCellTextDirection.LeftToRightTopToBottom;

            var ReportInterventionNextStepsGroupList = METTLib.Questionnaire.ROQuestionnaireGroupList.GetROQuestionnaireGroupList();

            foreach (var groupItem in ReportInterventionNextStepsGroupList)
            {
                docWriter.StartParagraph();
                docWriter.AddTextRun(groupItem.QuestionnaireGroup, fontBoldLarge);
                docWriter.EndParagraph();

                docWriter.StartParagraph();
                docWriter.AddTextRun("");
                docWriter.EndParagraph();

                docWriter.StartTable(3, NextStepstableProps);
                //HEADER ROW
                NextStepscellProps.BackColor = Color.DarkGray;
                docWriter.StartTableRow(NextStepsrowProps);
                NextStepscellProps.PreferredWidthAsPercentage = 15;
                docWriter.StartTableCell(NextStepscellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Indicator #");
                docWriter.EndParagraph();
                docWriter.EndTableCell();
                NextStepscellProps.PreferredWidthAsPercentage = 40;
                docWriter.StartTableCell(NextStepscellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Indicator");
                docWriter.EndParagraph();
                docWriter.EndTableCell();

                NextStepscellProps.PreferredWidthAsPercentage = 45;
                docWriter.StartTableCell(NextStepscellProps);
                docWriter.StartParagraph();
                docWriter.AddTextRun("Next Steps");
                docWriter.EndParagraph();
                docWriter.EndTableCell();
                docWriter.EndTableRow();

                NextStepscellProps.BackColor = Color.White;
                var iNo = 1;

                var ReportInterventionNextStepsList = METTLib.Reports.ReportInterventionNextStepList.GetReportInterventionNextStepList(284, groupItem.QuestionnaireGroupID);
                foreach (var item in ReportInterventionNextStepsList)
                {
                    docWriter.StartTableRow();

                    NextStepscellProps.PreferredWidthAsPercentage = 15;
                    docWriter.StartTableCell(NextStepscellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(Convert.ToString(iNo), fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    NextStepscellProps.PreferredWidthAsPercentage = 40;
                    docWriter.StartTableCell(NextStepscellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(item.IndicatorDetailName, fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    NextStepscellProps.PreferredWidthAsPercentage = 45;
                    docWriter.StartTableCell(NextStepscellProps);
                    docWriter.StartParagraph();
                    docWriter.AddTextRun(item.NextSteps, fontNormal);
                    docWriter.EndParagraph();
                    docWriter.EndTableCell();

                    docWriter.EndTableRow();
                    iNo++;
                }
                docWriter.EndTable();

                docWriter.StartParagraph();
                docWriter.AddTextRun("");
                docWriter.EndParagraph();
            }

            docWriter.StartParagraph();
            docWriter.AddTextRun("");
            docWriter.EndParagraph();

            docWriter.EndDocument();


            docWriter.Close();


            m.Position = 0;

            //Document doc = new Document();
            //m.Position = 0;
            //doc.Save(m);

            return(m);
        }