public static void Run() { //ExStart:EndParaGraphProperties // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); using (Presentation pres = new Presentation(dataDir + "Test.pptx")) { IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 200, 250); Paragraph para1 = new Paragraph(); para1.Portions.Add(new Portion("Sample text")); Paragraph para2 = new Paragraph(); para2.Portions.Add(new Portion("Sample text 2")); PortionFormat endParagraphPortionFormat = new PortionFormat(); endParagraphPortionFormat.FontHeight = 48; endParagraphPortionFormat.LatinFont = new FontData("Times New Roman"); para2.EndParagraphPortionFormat = endParagraphPortionFormat; shape.TextFrame.Paragraphs.Add(para1); shape.TextFrame.Paragraphs.Add(para2); pres.Save(dataDir + "pres.pptx", SaveFormat.Pptx); } }
public static void Run() { //ExStart:SetTextFormattingInsideTable // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tables(); // Create an instance of Presentation class Presentation presentation = new Presentation(dataDir + "pres.pptx"); ISlide slide = presentation.Slides[0]; ITable someTable = presentation.Slides[0].Shapes[0] as ITable; // let's say that the first shape on the first slide is a table // setting table cells' font height PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 25; someTable.SetTextFormat(portionFormat); // setting table cells' text alignment and right margin in one call ParagraphFormat paragraphFormat = new ParagraphFormat(); paragraphFormat.Alignment = TextAlignment.Right; paragraphFormat.MarginRight = 20; someTable.SetTextFormat(paragraphFormat); // setting table cells' text vertical type TextFrameFormat textFrameFormat = new TextFrameFormat(); textFrameFormat.TextVerticalType = TextVerticalType.Vertical; someTable.SetTextFormat(textFrameFormat); presentation.Save(dataDir + "result.pptx", Aspose.Slides.Export.SaveFormat.Pptx); //ExEnd:SetTextFormattingInsideTable }
/// <summary> /// Manipulate PowerPoint Presentation With Content /// </summary> /// <param name="presentationWithData_FilePath"></param> /// <param name="testData"></param> public static void ManipulatePowerPointPresentationWithContent(string presentationWithData_FilePath, TestData testData) { string listRespondents = null; int rowSeperatorNo = 3; double customRowHeight = 11.3; //sets row height as 0.4 cm try { // Creating a presentation instance using (Presentation presentationWithData = new Presentation(presentationWithData_FilePath)) { //Add respondent template slide to new presentation ISlide respondentTemplateSlide = presentationWithData.Slides[0]; presentationWithData.Slides.AddClone(respondentTemplateSlide); ISlide lastRespondentSlide = presentationWithData.Slides.Last(); int startSlideIndex = lastRespondentSlide.SlideNumber - 1; foreach (var name in testData.Respondents) { listRespondents += name + ", "; } //Remove additional trailing characters listRespondents = listRespondents.Trim(); listRespondents = listRespondents.TrimEnd(','); //Modify newly added respondent template slide with content foreach (IShape shp in lastRespondentSlide.Shapes) { if (shp != null) { var text = ((IAutoShape)shp).TextFrame.Text; if (text.StartsWith("List")) { ((IAutoShape)shp).TextFrame.Text = "Respondents with test list:\n" + listRespondents; } } } //Modify area template slide for each Slide ISlide areaTemplateSlide = presentationWithData.Slides[1]; foreach (var slide in testData.Slides) { List <double> listDblColsWidths = new List <double>(); List <double> listDblRowsHeights = new List <double>(); int rowCount = 0, colCount = 0; presentationWithData.Slides.AddClone(areaTemplateSlide); ISlide lastSlide = presentationWithData.Slides.Last(); //Delete all existing tables from area slide for (int k = 0; k < lastSlide.Shapes.Count(); k++) { var shp = lastSlide.Shapes[k]; if (shp is ITable) //Delete if shape is table { lastSlide.Shapes.Remove(shp); k = k - 1; //Decrement counter as one shape has been deleted } } // Iterate through shapes to find the placeholder foreach (IShape shp in lastSlide.Shapes) { if (shp.Placeholder != null) { // Change the text of placeholder ((IAutoShape)shp).TextFrame.Text = slide.Header; } } //Add Average Table to slide double[] avgTableColWidth = { 50, 23 }; double[] avgTableRowHeight = { customRowHeight }; ITable avgTable = lastSlide.Shapes.AddTable(50, 100, avgTableColWidth, avgTableRowHeight); avgTable[0, 0].TextFrame.Text = "Average"; avgTable[1, 0].TextFrame.Text = Convert.ToString(slide.AverageScore); avgTable[1, 0].FillFormat.FillType = FillType.Solid; avgTable[1, 0].FillFormat.SolidFillColor.Color = Color.Yellow; avgTable.StylePreset = TableStylePreset.NoStyleNoGrid; avgTable.Name = "tblAverage"; // setting table cells' font height PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 7; avgTable.SetTextFormat(portionFormat); int emptyRowsCount = (slide.Questions.Count() / rowSeperatorNo); // Add Question table to slide rowCount = slide.Questions.Count() + 1 + emptyRowsCount; colCount = testData.Respondents.Count() + 1; for (int row = 0; row < rowCount; row++) { listDblRowsHeights.Add(customRowHeight); } listDblColsWidths.Add(200); for (int col = 1; col < colCount; col++) { listDblColsWidths.Add(33); } double[] dblColsWidths = listDblColsWidths.ToArray(); double[] dblRowsHeights = listDblRowsHeights.ToArray(); ITable questionsTable = lastSlide.Shapes.AddTable(50, 111, dblColsWidths, dblRowsHeights); questionsTable.StylePreset = TableStylePreset.NoStyleNoGrid; questionsTable.Name = "tblQuestions"; ITable shpQuestionsTable = (ITable)lastSlide.Shapes.First(x => x.Name == "tblQuestions"); // setting table cells' font height shpQuestionsTable.SetTextFormat(portionFormat); int rowSeperatorMod = rowSeperatorNo + 1; for (int i = 1, q = 0; i < questionsTable.Rows.Count; i++) { if (i % rowSeperatorMod == 0) { continue; } questionsTable[0, i].TextFrame.Text = slide.Questions[q].Title; for (int j = 0; j < questionsTable.Columns.Count - 1; j++) { questionsTable[j + 1, 0].TextFrame.Text = testData.Respondents[j]; questionsTable[j + 1, i].TextFrame.Text = Convert.ToString(slide.Questions[q].Responses[j]); } q++; } // Set margin top and bottom as 0 for each cell foreach (IRow row in questionsTable.Rows) { foreach (ICell cell in row) { cell.MarginTop = 0; cell.MarginBottom = 0; } } } //Delete all template slides for (int i = startSlideIndex - 1; i >= 0; i--) { presentationWithData.Slides.RemoveAt(i); } //Writing the presentation as a PPTX file presentationWithData.Save(presentationWithData_FilePath, SaveFormat.Pptx); } } catch (Exception ex) { throw ex; } }
static void Main(string[] args) { MainAsync(args).Wait(); string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName.ToString(); // Directory Path string JsonData = File.ReadAllText(Path.GetFullPath(path) + "\\Json\\project.json"); //for temporary usage ..for production mainasync method will be used for fetching data ProjectModel pmodel = new ProjectModel(); pmodel = JsonConvert.DeserializeObject <ProjectModel>(JsonData); //Instantiate Prsentation class that represents the PPTX Presentation pres = new Presentation(); //Get the first slide string currentDir = Path.GetFullPath(path) + "\\pptFolder\\"; ISlide sld = pres.Slides[0]; sld.Name = "Existing Tender"; //formatting Text PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 10; ProjectSummary.Logo(); #region Border IAutoShape borderLines = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 3, 3, 715, 535); borderLines.FillFormat.FillType = FillType.NoFill; borderLines.FillFormat.SolidFillColor.Color = Color.Black; #endregion #region Background //Add some text IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 350, 20); //ashp.FillFormat.FillType = FillType.NoFill; //ashp.LineFormat.FillFormat.FillType = FillType.NoFill; // Add TextFrame to the Rectangle ashp.AddTextFrame(" "); ashp.FillFormat.SolidFillColor.Color = Color.DarkCyan; // Accessing the text frame ITextFrame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame IParagraph para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph IPortion portion = para.Portions[0]; // Set Text portion.Text = "Background"; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.White; portion.PortionFormat.FontBold = NullableBool.True; #region Table 1 double[] dblCols1 = { 60, 100, 190 }; double[] dblRows1 = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; ITable tb1 = sld.Shapes.AddTable(10, 40, dblCols1, dblRows1); for (int i = 0; i < tb1.Rows.Count; i++) { for (int j = 0; j < tb1.Rows[i].Count; j++) { //adding border to each cell of the table tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderTop.Width = 1; tb1[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderBottom.Width = 1; tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; tb1[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderRight.Width = 1; //cell with white background tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first column if (j == 0) { tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } //for 7th to last custom row if (i >= 7) { tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.White; tb1[j, i].BorderLeft.Width = 1; tb1[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.White; tb1[j, i].BorderBottom.Width = 1; tb1[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.White; tb1[j, i].BorderRight.Width = 1; tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.White; tb1[j, i].BorderTop.Width = 1; if (i == 7) { tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderTop.Width = 1; } if (j == 2) { tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; } if (j == 2) { tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; } tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.White; } } } tb1.SetTextFormat(portionFormat); Bitmap image = new Bitmap(currentDir + "imagelogo.jpg"); // Create an IPPImage object using the bitmap object IPPImage imgx1 = pres.Images.AddImage(image); // Add image to column 2 table cell tb1[2, 0].FillFormat.FillType = FillType.Picture; tb1[2, 0].FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch; tb1[2, 0].FillFormat.PictureFillFormat.Picture.Image = imgx1; tb1.MergeCells(tb1[2, 0], tb1[2, 1], false); tb1.MergeCells(tb1[2, 0], tb1[2, 2], false); tb1.MergeCells(tb1[2, 0], tb1[2, 3], false); tb1.MergeCells(tb1[2, 0], tb1[2, 4], false); tb1.MergeCells(tb1[2, 0], tb1[2, 5], false); tb1.MergeCells(tb1[2, 0], tb1[2, 6], false); tb1.MergeCells(tb1[2, 0], tb1[2, 7], false); tb1.MergeCells(tb1[2, 0], tb1[2, 8], false); tb1.MergeCells(tb1[2, 0], tb1[2, 9], false); #endregion //column Names: tb1[0, 0].TextFrame.Text = "ProjectName"; tb1[0, 1].TextFrame.Text = "Country"; tb1[0, 2].TextFrame.Text = "Region"; tb1[0, 3].TextFrame.Text = "Mode"; tb1[0, 4].TextFrame.Text = "Project Type"; tb1[0, 5].TextFrame.Text = "Project Id"; tb1[0, 6].TextFrame.Text = "Updated Date"; //inserting values from project tb1[1, 0].TextFrame.Text = pmodel.ProjectName; tb1[1, 1].TextFrame.Text = pmodel.Country; tb1[1, 2].TextFrame.Text = pmodel.Region; tb1[1, 3].TextFrame.Text = Enum.GetName(typeof(EnumValue.Mode), pmodel.Mode); tb1[1, 4].TextFrame.Text = Enum.GetName(typeof(EnumValue.TenderStatus), pmodel.DealStatus); tb1[1, 5].TextFrame.Text = pmodel.ProjectId; tb1[1, 6].TextFrame.Text = "7/09/2017"; #region Table 2 double[] coltbl2 = { 350 }; double[] rowtbl2 = { 20, 50, 20, 50 }; ITable tb2 = sld.Shapes.AddTable(10, 230, coltbl2, rowtbl2); for (int i = 0; i < tb2.Rows.Count; i++) { for (int j = 0; j < tb2.Rows[i].Count; j++) { //border for each cell tb2[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderTop.Width = 1; tb2[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderBottom.Width = 1; tb2[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderLeft.Width = 1; tb2[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderRight.Width = 1; tb2[j, i].FillFormat.FillType = FillType.Solid; if (i % 2 == 0) { tb2[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } else { tb2[j, i].FillFormat.SolidFillColor.Color = Color.White; } } } //Text Entry tb2[0, 0].TextFrame.Text = "Description"; tb2[0, 1].TextFrame.Text = pmodel.Description; tb2[0, 2].TextFrame.Text = "Strategic Rationale"; tb2[0, 3].TextFrame.Text = pmodel.StrategicRationale; tb2.SetTextFormat(portionFormat); #endregion #region Table 3 // Table 3a double[] coltbl3a = { 40, 40, 40, 40 }; double[] rowtbl3a = { 10, 10, 10, 10, 10 }; ITable tb3a = sld.Shapes.AddTable(10, 400, coltbl3a, rowtbl3a); portionFormat.FontHeight = 10; tb3a.SetTextFormat(portionFormat); for (int i = 0; i < tb3a.Rows.Count; i++) { for (int j = 0; j < tb3a.Rows[i].Count; j++) { tb3a[j, i].FillFormat.FillType = FillType.Solid; if (i == 0 && j == 0) { tb3a[j, i].FillFormat.FillType = FillType.NoFill; } else { if ((i == 0 && j > 0) || (j == 0 && i > 0)) { tb3a[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } else { tb3a[j, i].FillFormat.SolidFillColor.Color = Color.White; } //border for each cell tb3a[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb3a[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb3a[j, i].BorderTop.Width = 1; tb3a[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb3a[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb3a[j, i].BorderBottom.Width = 1; tb3a[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb3a[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb3a[j, i].BorderLeft.Width = 1; tb3a[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb3a[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb3a[j, i].BorderRight.Width = 1; } } } //column names: tb3a[1, 0].TextFrame.Text = "2017"; tb3a[2, 0].TextFrame.Text = "2018"; tb3a[3, 0].TextFrame.Text = "2019"; tb3a[0, 1].TextFrame.Text = "Revenue"; tb3a[0, 2].TextFrame.Text = "EBIT"; tb3a[0, 3].TextFrame.Text = "Capex"; tb3a[0, 4].TextFrame.Text = "MTP"; tb3a[1, 1].TextFrame.Text = pmodel.RevenueX.ToString(); tb3a[2, 1].TextFrame.Text = pmodel.RevenueX1.ToString(); tb3a[3, 1].TextFrame.Text = pmodel.RevenueX2.ToString(); tb3a[1, 2].TextFrame.Text = pmodel.EbitX.ToString(); tb3a[2, 2].TextFrame.Text = pmodel.EbitX1.ToString(); tb3a[3, 2].TextFrame.Text = pmodel.EbitX2.ToString(); tb3a[1, 3].TextFrame.Text = pmodel.CAPEXXMEuro.ToString(); tb3a[2, 3].TextFrame.Text = pmodel.CAPEX1MEuro.ToString(); tb3a[3, 3].TextFrame.Text = pmodel.CAPEX2MEuro.ToString(); // Table 3b double[] coltbl3b = { 100, 50 }; double[] rowtbl3b = { 10, 10, 10 }; ITable tb3b = sld.Shapes.AddTable(200, 400, coltbl3b, rowtbl3b); portionFormat.FontHeight = 10; tb3b.SetTextFormat(portionFormat); for (int i = 0; i < tb3b.Rows.Count; i++) { for (int j = 0; j < tb3b.Rows[i].Count; j++) { tb3b[j, i].FillFormat.FillType = FillType.Solid; if (j == 0) { tb3b[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } else { tb3b[j, i].FillFormat.SolidFillColor.Color = Color.White; } //border for each cell tb3b[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb3b[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb3b[j, i].BorderTop.Width = 1; tb3b[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb3b[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb3b[j, i].BorderBottom.Width = 1; tb3b[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb3b[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb3b[j, i].BorderLeft.Width = 1; tb3b[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb3b[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb3b[j, i].BorderRight.Width = 1; } } //columns name tb3b[0, 0].TextFrame.Text = "EBIT"; tb3b[0, 1].TextFrame.Text = "Number of vehicles"; tb3b[0, 2].TextFrame.Text = "Contract Length"; tb3b[0, 0].TextFrame.Text = pmodel.New_or_existingwork.ToString(); tb3b[0, 1].TextFrame.Text = pmodel.NumberOfVehicles.ToString(); tb3b[0, 2].TextFrame.Text = pmodel.CoreContractLength.ToString(); #endregion #endregion #region Status //Add some text IAutoShape ashp1 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 400, 10, 300, 20); // Add TextFrame to the Rectangle ashp1.AddTextFrame(""); ashp1.FillFormat.SolidFillColor.Color = Color.DarkCyan; // Accessing the text frame ITextFrame txtFrame1 = ashp1.TextFrame; // Create the Paragraph object for text frame IParagraph para1 = txtFrame1.Paragraphs[0]; // Create Portion object for paragraph IPortion portion1 = para1.Portions[0]; // Set Text portion1.Text = "Status"; portion1.PortionFormat.FillFormat.FillType = FillType.Solid; portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.White; portion1.PortionFormat.FontBold = NullableBool.True; #region Table 4 //Define columns with widths and rows with heights //double[] dblCols = { 50, 50, 50 }; double[] dblCols = { 80, 100, 60, 60 }; double[] dblRows = { 20, 20, 20, 20, 40, 30 }; //Add table shape to slide ITable tb4 = sld.Shapes.AddTable(400, 40, dblCols, dblRows); tb4.SetTextFormat(portionFormat); for (int i = 0; i < tb4.Rows.Count; i++) { for (int j = 0; j < tb4.Rows[i].Count; j++) { //adding border to each cell of the table tb4[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb4[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb4[j, i].BorderTop.Width = 1; tb4[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb4[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb4[j, i].BorderBottom.Width = 1; tb4[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb4[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb4[j, i].BorderLeft.Width = 1; tb4[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb4[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb4[j, i].BorderRight.Width = 1; //cell with white background tb4[j, i].FillFormat.FillType = FillType.Solid; tb4[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first column if (j == 0) { tb4[j, i].FillFormat.FillType = FillType.Solid; tb4[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } //color for cell //caution: color it before split otherwise left portion of split cell will be coloured tb4[3, 5].FillFormat.FillType = FillType.Solid; tb4[3, 5].FillFormat.SolidFillColor.Color = Color.ForestGreen; tb4.SetTextFormat(portionFormat); //Set border format for each cell //Merge cells 1 & 2 of row 1 tb4.MergeCells(tb4[1, 4], tb4[2, 4], false); tb4.MergeCells(tb4[2, 4], tb4[3, 4], false); tb4.MergeCells(tb4[1, 5], tb4[2, 5], false); tb4[3, 5].SplitByWidth(tb4[3, 5].Width / 2); tb4.MergeCells(tb4[2, 5], tb4[3, 5], false); // tb4[1, 4].TextFrame.Text = ""; //column names: tb4[0, 0].TextFrame.Text = "Division Responsible"; tb4[0, 1].TextFrame.Text = "Executive Board Member"; tb4[0, 2].TextFrame.Text = "Country Manager"; tb4[0, 3].TextFrame.Text = "Project Manager"; tb4[0, 4].TextFrame.Text = "Team Members(and role) OR requirements"; tb4[0, 5].TextFrame.Text = "Uncovered Team Resources"; tb4[2, 0].TextFrame.Text = "Contract Type"; tb4[2, 1].TextFrame.Text = "Project Stage"; tb4[2, 2].TextFrame.Text = "Type"; tb4[2, 3].TextFrame.Text = "Probability"; //project values: tb4[1, 0].TextFrame.Text = pmodel.AdditionalTeamMembers; tb4[1, 1].TextFrame.Text = pmodel.ExecutiveBoardMember; tb4[1, 2].TextFrame.Text = pmodel.CountryManager; tb4[1, 3].TextFrame.Text = pmodel.ProjectManager; tb4[1, 4].TextFrame.Text = pmodel.UncoveredTeamResources; tb4[2, 0].TextFrame.Text = Enum.GetName(typeof(EnumValue.ContractType), pmodel.ContractType); tb4[2, 1].TextFrame.Text = Enum.GetName(typeof(EnumValue.ContractType), pmodel.ProjectStageTender); tb4[2, 2].TextFrame.Text = "A(>500)"; tb4[2, 3].TextFrame.Text = "60%"; #endregion #region Table 5 double[] dblCols5 = { 80, 160, 30, 30 }; double[] dblRows5 = { 10, 10, 10, 10, 10, 10, 10, 10, 10 }; ITable tb5 = sld.Shapes.AddTable(400, 200, dblCols5, dblRows5); for (int i = 0; i < tb5.Rows.Count; i++) { for (int j = 0; j < tb5.Rows[i].Count; j++) { //adding border to each cell of the table tb5[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb5[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb5[j, i].BorderTop.Width = 1; tb5[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb5[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb5[j, i].BorderBottom.Width = 1; tb5[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb5[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb5[j, i].BorderLeft.Width = 1; tb5[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb5[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb5[j, i].BorderRight.Width = 1; //cell with white background tb5[j, i].FillFormat.FillType = FillType.Solid; tb5[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first column if (i < 2 || j == 3) { tb5[j, i].FillFormat.FillType = FillType.Solid; tb5[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb5.SetTextFormat(portionFormat); //column names: tb5[0, 0].TextFrame.Text = "KeyMilestone & Action"; tb5[0, 1].TextFrame.Text = "Date"; tb5[1, 1].TextFrame.Text = "Task/Event"; tb5[2, 1].TextFrame.Text = "Resp"; tb5[3, 1].TextFrame.Text = "Status"; for (int i = 2; i <= pmodel.KeyMileStoneAndAction.Count + 1; i++) { tb5[0, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Date; tb5[1, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].TaskEvent; tb5[2, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Resp; tb5[3, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Status; } #endregion #region Table 6 double[] dblCols6 = { 300 }; double[] dblRows6 = { 20, 40 }; ITable tb6 = sld.Shapes.AddTable(400, 380, dblCols6, dblRows6); tb6.SetTextFormat(portionFormat); for (int i = 0; i < tb6.Rows.Count; i++) { for (int j = 0; j < tb6.Rows[i].Count; j++) { //adding border to each cell of the table tb6[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb6[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb6[j, i].BorderTop.Width = 1; tb6[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb6[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb6[j, i].BorderBottom.Width = 1; tb6[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb6[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb6[j, i].BorderLeft.Width = 1; tb6[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb6[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb6[j, i].BorderRight.Width = 1; //cell with white background tb6[j, i].FillFormat.FillType = FillType.Solid; tb6[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first column if (i == 0 && j == 0) { tb6[j, i].FillFormat.FillType = FillType.Solid; tb6[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } #endregion tb6[0, 0].TextFrame.Text = "Status Description"; tb6[0, 1].TextFrame.Text = pmodel.StatusDescription; #region Table 7 double[] dblCols7 = { 240, 30, 30 }; double[] dblRows7 = { 20, 20, 20, 20 }; ITable tb7 = sld.Shapes.AddTable(400, 445, dblCols7, dblRows7); tb7.SetTextFormat(portionFormat); for (int i = 0; i < tb7.Rows.Count; i++) { for (int j = 0; j < tb7.Rows[i].Count; j++) { //adding border to each cell of the table tb7[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb7[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb7[j, i].BorderTop.Width = 1; tb7[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb7[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb7[j, i].BorderBottom.Width = 1; tb7[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb7[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb7[j, i].BorderLeft.Width = 1; tb7[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb7[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb7[j, i].BorderRight.Width = 1; //cell with white background tb7[j, i].FillFormat.FillType = FillType.Solid; tb7[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first column if (i == 0) { tb7[j, i].FillFormat.FillType = FillType.Solid; tb7[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } #endregion tb7[0, 0].TextFrame.Text = "Issue For Discussion"; for (int i = 1; i <= pmodel.Issues.Count; i++) { tb7[0, i].TextFrame.Text = pmodel.Issues[i - 1].Issues; tb7[1, i].TextFrame.Text = pmodel.Issues[i - 1].Owner; tb7[2, i].TextFrame.Text = pmodel.Issues[i - 1].Date; } #endregion #region projectsummary ProjectSummary.ProjSummary1(ref pres); #endregion #region Opportunities Schedule ProjectSummary.OpportunitiesSchedule(ref pres); #endregion Console.Write("ppt in progress"); pres.Save(currentDir + "Table.pptx", Export.SaveFormat.Pptx); }
public static void OpportunitiesSchedule(ref Presentation p) { PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 10; IMasterLayoutSlideCollection layoutSlides = p.Masters[0].LayoutSlides; ILayoutSlide layoutSlide = layoutSlides.GetByType(SlideLayoutType.TitleAndObject) ?? layoutSlides.GetByType(SlideLayoutType.Title); //add new slide in presentation p.Slides.AddEmptySlide(layoutSlide); #region Table Rows/Column double[] dblCols = { 10, 20, 30, 100, 20, 40, 40, 40, 50, 30, 30, 30, 30, 30, 30, 30, 30, 40, 70 }; double[] dblRows = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; #endregion #region Opportunities Schedule – Existing Tenders by Priority ISlide sld = p.Slides[4]; sld.Name = "Opportunities Schedule sheet 1"; // Add an AutoShape of Rectangle type IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 350, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; // Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame ITextFrame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame IParagraph para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph IPortion portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Opportunities Schedule – Existing Tenders by Priority"; //Add table shape to slide ITable tb1 = sld.Shapes.AddTable(5, 100, dblCols, dblRows); for (int i = 0; i < tb1.Rows.Count; i++) { for (int j = 0; j < tb1.Rows[i].Count; j++) { if (i == 9 && (j < 8 || j > 17)) { tb1[j, i].FillFormat.FillType = FillType.NoFill; } else { //adding border to each cell of the table tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderTop.Width = 1; tb1[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderBottom.Width = 1; tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; tb1[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderRight.Width = 1; //cell with white background tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.White; } //Grey color for first row if (i == 0) { tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } for (int j = 0; j < tb1.Rows[0].Count; j++) { //Merge first and second row in header for specific column if (j < 8 || j > 17) { tb1.MergeCells(tb1[j, 0], tb1[j, 1], false); } // merge three columns in first row if (j == 9 || j == 12 || j == 15) { tb1.MergeCells(tb1[j, 0], tb1[j + 1, 0], false); tb1.MergeCells(tb1[j, 0], tb1[j + 2, 0], false); } } tb1[0, 0].TextFrame.Text = "#"; tb1[1, 0].TextFrame.Text = "BU"; tb1[2, 0].TextFrame.Text = "Priority"; tb1[3, 0].TextFrame.Text = "Existing Tenders"; tb1[4, 0].TextFrame.Text = "Stage"; tb1[5, 0].TextFrame.Text = "Contract Date"; tb1[6, 0].TextFrame.Text = "Directors Approval"; tb1[7, 0].TextFrame.Text = "Team Yrs."; tb1[8, 0].TextFrame.Text = "Category"; tb1[9, 0].TextFrame.Text = " "; tb1[10, 0].TextFrame.Text = ""; tb1[11, 0].TextFrame.Text = "Revenue (€m)"; tb1[12, 0].TextFrame.Text = ""; tb1[13, 0].TextFrame.Text = ""; tb1[14, 0].TextFrame.Text = "EBIT (€m)"; tb1[15, 0].TextFrame.Text = ""; tb1[16, 0].TextFrame.Text = ""; tb1[17, 0].TextFrame.Text = "CAPEX (€m)"; tb1[18, 0].TextFrame.Text = "EBIT/CAPEX"; tb1[8, 9].TextFrame.Text = "Total MTP"; //txtFrame = tb1[8, 9].TextFrame; tb1.SetTextFormat(portionFormat); StageInfo(ref sld); #endregion #region "Opportunities Schedule – New Tenders by priority" p.Slides.AddEmptySlide(layoutSlide); ISlide sld1 = p.Slides[5]; #region Table Rows/Column double[] dblCols1 = { 10, 20, 30, 100, 20, 40, 40, 40, 50, 30, 30, 30, 30, 30, 30, 30, 30, 40, 70 }; double[] dblRows1 = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; #endregion IAutoShape ashp1 = sld1.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 350, 50); ashp1.FillFormat.FillType = FillType.NoFill; ashp1.LineFormat.FillFormat.FillType = FillType.NoFill; ashp1.AddTextFrame(" "); // Accessing the text frame ITextFrame txtFrame1 = ashp1.TextFrame; // Create the Paragraph object for text frame IParagraph para1 = txtFrame1.Paragraphs[0]; // Create Portion object for paragraph IPortion portion1 = para1.Portions[0]; portion1.PortionFormat.FontHeight = 25; portion1.PortionFormat.FillFormat.FillType = FillType.Solid; portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion1.PortionFormat.FontBold = NullableBool.True; // Set Text portion1.Text = "Opportunities Schedule – New Tenders by Priority"; //Add table shape to slide ITable tb2 = sld1.Shapes.AddTable(5, 100, dblCols, dblRows); for (int i = 0; i < tb2.Rows.Count; i++) { for (int j = 0; j < tb2.Rows[i].Count; j++) { if ((i == 9 || i == 4) && (j < 8 || j > 17)) { tb2[j, i].FillFormat.FillType = FillType.NoFill; } //else if (i == 4 && (j < 8 || j > 17)) //{ // tb2[j, i].FillFormat.FillType = FillType.NoFill; //} else { //adding border to each cell of the table tb2[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderTop.Width = 1; tb2[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderBottom.Width = 1; tb2[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderLeft.Width = 1; tb2[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderRight.Width = 1; //cell with white background tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.White; } //Grey color for first row if (i == 0) { tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } for (int j = 0; j < tb2.Rows[0].Count; j++) { //Merge first and second row in header for specific column if (j < 8 || j > 17) { tb2.MergeCells(tb2[j, 0], tb2[j, 1], false); } // merge three columns in first row if (j == 9 || j == 12 || j == 15) { tb2.MergeCells(tb2[j, 0], tb2[j + 1, 0], false); tb2.MergeCells(tb2[j, 0], tb2[j + 2, 0], false); } } tb2[8, 4].TextFrame.Text = "TOTAL MTP"; tb2[0, 0].TextFrame.Text = "#"; tb2[1, 0].TextFrame.Text = "BU"; tb2[2, 0].TextFrame.Text = "Priority"; tb2[3, 0].TextFrame.Text = "New Tenders"; tb2[4, 0].TextFrame.Text = "Stage"; tb2[5, 0].TextFrame.Text = "Contract Date"; tb2[6, 0].TextFrame.Text = "Directors Approval"; tb2[7, 0].TextFrame.Text = "Team Yrs."; tb2[8, 0].TextFrame.Text = "Category"; tb2[9, 0].TextFrame.Text = " "; tb2[10, 0].TextFrame.Text = ""; tb2[11, 0].TextFrame.Text = "Revenue (€m)"; tb2[12, 0].TextFrame.Text = ""; tb2[13, 0].TextFrame.Text = ""; tb2[14, 0].TextFrame.Text = "EBIT (€m)"; tb2[15, 0].TextFrame.Text = ""; tb2[16, 0].TextFrame.Text = ""; tb2[17, 0].TextFrame.Text = "CAPEX (€m)"; tb2[18, 0].TextFrame.Text = "EBIT/CAPEX"; tb2[8, 9].TextFrame.Text = "Total MTP"; //txtFrame = tb2[8, 9].TextFrame; tb2.SetTextFormat(portionFormat); StageInfo(ref sld1); #endregion }
public static void ProjSummary1(ref Presentation p) { //formatting font text for table TextFrame PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 10; IMasterLayoutSlideCollection layoutSlides = p.Masters[0].LayoutSlides; ILayoutSlide layoutSlide = layoutSlides.GetByType(SlideLayoutType.TitleAndObject) ?? layoutSlides.GetByType(SlideLayoutType.Title); p.Slides.AddEmptySlide(layoutSlide); #region Table Rows/Column double[] dblCols = { 20, 150, 50, 50, 150, 150, 50, 50 }; double[] dblRows = { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }; #endregion #region project summary (1/3) ISlide sld = p.Slides[1]; sld.Name = "Project Summary sheet 1"; // Add an AutoShape of Rectangle type IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 350, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; // Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame ITextFrame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame IParagraph para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph IPortion portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; IPortionFormat pf = portion.PortionFormat; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (1/3) – existing tenders (Priority 1)"; //existing tenders //Add table shape to slide ITable tb1 = sld.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb1.Rows.Count; i++) { for (int j = 0; j < tb1.Rows[i].Count; j++) { //adding border to each cell of the table tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderTop.Width = 1; tb1[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderBottom.Width = 1; tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; tb1[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderRight.Width = 1; //cell with white background tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb1[0, 0].TextFrame.Text = "Nr"; tb1[1, 0].TextFrame.Text = "Existing Tenders"; tb1[2, 0].TextFrame.Text = "RAG current month"; tb1[3, 0].TextFrame.Text = "RAG previous month"; tb1[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb1[5, 0].TextFrame.Text = "Action agreed"; tb1[6, 0].TextFrame.Text = "Project Manger"; tb1[7, 0].TextFrame.Text = "Accountable"; tb1.SetTextFormat(portionFormat); #endregion #region project summary(2/3) p.Slides.AddEmptySlide(layoutSlide); ISlide sld1 = p.Slides[2]; sld1.Name = "Project Summary sheet 2"; // Add an AutoShape of Rectangle type ashp = sld1.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 400, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; //// Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (2/3) – new tenders"; //Add table shape to slide ITable tb2 = sld1.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb2.Rows.Count; i++) { for (int j = 0; j < tb2.Rows[i].Count; j++) { //adding border to each cell of the table tb2[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderTop.Width = 1; tb2[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderBottom.Width = 1; tb2[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderLeft.Width = 1; tb2[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderRight.Width = 1; //cell with white background tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb2[0, 0].TextFrame.Text = "Nr"; tb2[1, 0].TextFrame.Text = "Existing Tenders"; tb2[2, 0].TextFrame.Text = "RAG current month"; tb2[3, 0].TextFrame.Text = "RAG previous month"; tb2[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb2[5, 0].TextFrame.Text = "Action agreed"; tb2[6, 0].TextFrame.Text = "Project Manger"; tb2[7, 0].TextFrame.Text = "Accountable"; tb2.SetTextFormat(portionFormat); #endregion #region project summary(3/3) p.Slides.AddEmptySlide(layoutSlide); ISlide sld2 = p.Slides[3]; sld2.Name = "Project Summary sheet 3"; // Add an AutoShape of Rectangle type ashp = sld2.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 400, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; //// Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (3/3) – M&A existing and new countries"; //Add table shape to slide ITable tb3 = sld2.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb3.Rows.Count; i++) { for (int j = 0; j < tb3.Rows[i].Count; j++) { //adding border to each cell of the table tb3[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderTop.Width = 1; tb3[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderBottom.Width = 1; tb3[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderLeft.Width = 1; tb3[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderRight.Width = 1; //cell with white background tb3[j, i].FillFormat.FillType = FillType.Solid; tb3[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb3[j, i].FillFormat.FillType = FillType.Solid; tb3[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb3[0, 0].TextFrame.Text = "Nr"; tb3[1, 0].TextFrame.Text = "Growth Opportunities (Tenders): Priority 1"; tb3[2, 0].TextFrame.Text = "RAG current month"; tb3[3, 0].TextFrame.Text = "RAG previous month"; tb3[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb3[5, 0].TextFrame.Text = "Action agreed"; tb3[6, 0].TextFrame.Text = "Project Manger"; tb3[7, 0].TextFrame.Text = "Accountable"; tb3.SetTextFormat(portionFormat); #endregion }