コード例 #1
0
        public static void FormatBlPoint(SlidePart slidePart)
        {
            IEnumerable <Shape> bulletPointShapes = slidePart.Slide.Descendants <Shape>().Where(d => d.Descendants <NonVisualDrawingProperties>().Where(e => e.Name.InnerText.Contains(Constants._TEXTBOX_)).Count() > 0);

            foreach (Shape shape in bulletPointShapes)
            {
                IEnumerable <D.Paragraph> paragraphs = shape.Descendants <D.Paragraph>().Where(d => d.Descendants <D.ParagraphProperties>().Count() > 0);
                foreach (D.Paragraph paragraph in paragraphs)
                {
                    D.ParagraphProperties paragProps = paragraph.Descendants <D.ParagraphProperties>().FirstOrDefault();
                    if (paragProps != default(D.ParagraphProperties))
                    {
                        D.BulletFont bulletFont = paragProps.Descendants <D.BulletFont>().FirstOrDefault();
                        if (bulletFont != default(D.BulletFont))
                        {
                            bulletFont.CharacterSet = 0;
                            bulletFont.PitchFamily  = 34;
                            bulletFont.Typeface     = "Arial";
                        }

                        D.CharacterBullet characterBullet = paragProps.Descendants <D.CharacterBullet>().FirstOrDefault();

                        if (characterBullet != default(D.CharacterBullet))
                        {
                            characterBullet.Char = new DocumentFormat.OpenXml.StringValue("•");
                        }
                        else
                        {
                            D.AutoNumberedBullet autoNumberedBullet = paragProps.Descendants <D.AutoNumberedBullet>().FirstOrDefault();
                            if (autoNumberedBullet != default(D.AutoNumberedBullet))
                            {
                                autoNumberedBullet.Remove();
                                slidePart.Slide.Save();
                            }
                            characterBullet = new D.CharacterBullet()
                            {
                                Char = new DocumentFormat.OpenXml.StringValue("•")
                            };
                            paragProps.AppendChild(characterBullet);
                        }
                        D.Run run = paragraph.Descendants <D.Run>().FirstOrDefault();
                        run.RunProperties.Italic    = false;
                        run.RunProperties.Bold      = false;
                        run.RunProperties.Underline = D.TextUnderlineValues.None;
                    }
                }
            }
            slidePart.Slide.Save();
        }
コード例 #2
0
        // Generates content of slidePart1.
        private void GenerateSlidePart1Content(SlidePart slidePart1)
        {
            Slide slide1 = new Slide();
            slide1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            slide1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            slide1.AddNamespaceDeclaration("p", "http://schemas.openxmlformats.org/presentationml/2006/main");

            CommonSlideData commonSlideData2 = new CommonSlideData();

            ShapeTree shapeTree2 = new ShapeTree();

            NonVisualGroupShapeProperties nonVisualGroupShapeProperties2 = new NonVisualGroupShapeProperties();
            NonVisualDrawingProperties nonVisualDrawingProperties7 = new NonVisualDrawingProperties(){ Id = (UInt32Value)1U, Name = "" };
            NonVisualGroupShapeDrawingProperties nonVisualGroupShapeDrawingProperties2 = new NonVisualGroupShapeDrawingProperties();
            ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties7 = new ApplicationNonVisualDrawingProperties();

            nonVisualGroupShapeProperties2.Append(nonVisualDrawingProperties7);
            nonVisualGroupShapeProperties2.Append(nonVisualGroupShapeDrawingProperties2);
            nonVisualGroupShapeProperties2.Append(applicationNonVisualDrawingProperties7);

            GroupShapeProperties groupShapeProperties2 = new GroupShapeProperties();

            A.TransformGroup transformGroup2 = new A.TransformGroup();
            A.Offset offset7 = new A.Offset(){ X = 0L, Y = 0L };
            A.Extents extents7 = new A.Extents(){ Cx = 0L, Cy = 0L };
            A.ChildOffset childOffset2 = new A.ChildOffset(){ X = 0L, Y = 0L };
            A.ChildExtents childExtents2 = new A.ChildExtents(){ Cx = 0L, Cy = 0L };

            transformGroup2.Append(offset7);
            transformGroup2.Append(extents7);
            transformGroup2.Append(childOffset2);
            transformGroup2.Append(childExtents2);

            groupShapeProperties2.Append(transformGroup2);

            Shape shape6 = new Shape();

            NonVisualShapeProperties nonVisualShapeProperties6 = new NonVisualShapeProperties();
            NonVisualDrawingProperties nonVisualDrawingProperties8 = new NonVisualDrawingProperties(){ Id = (UInt32Value)4U, Name = "TextBox 3" };
            NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties6 = new NonVisualShapeDrawingProperties(){ TextBox = true };
            ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties8 = new ApplicationNonVisualDrawingProperties();

            nonVisualShapeProperties6.Append(nonVisualDrawingProperties8);
            nonVisualShapeProperties6.Append(nonVisualShapeDrawingProperties6);
            nonVisualShapeProperties6.Append(applicationNonVisualDrawingProperties8);

            ShapeProperties shapeProperties6 = new ShapeProperties();

            A.Transform2D transform2D6 = new A.Transform2D();
            A.Offset offset8 = new A.Offset(){ X = 1905000L, Y = 1295400L };
            A.Extents extents8 = new A.Extents(){ Cx = 6172200L, Cy = 2862322L };

            transform2D6.Append(offset8);
            transform2D6.Append(extents8);

            A.PresetGeometry presetGeometry6 = new A.PresetGeometry(){ Preset = A.ShapeTypeValues.Rectangle };
            A.AdjustValueList adjustValueList6 = new A.AdjustValueList();

            presetGeometry6.Append(adjustValueList6);
            A.NoFill noFill2 = new A.NoFill();

            shapeProperties6.Append(transform2D6);
            shapeProperties6.Append(presetGeometry6);
            shapeProperties6.Append(noFill2);

            TextBody textBody6 = new TextBody();

            A.BodyProperties bodyProperties6 = new A.BodyProperties(){ Wrap = A.TextWrappingValues.Square, RightToLeftColumns = false };
            A.ShapeAutoFit shapeAutoFit1 = new A.ShapeAutoFit();

            bodyProperties6.Append(shapeAutoFit1);
            A.ListStyle listStyle6 = new A.ListStyle();

            A.Paragraph paragraph10 = new A.Paragraph();

            A.Run run9 = new A.Run();

            A.RunProperties runProperties10 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties10.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text10 = new A.Text();
            text10.Text = "Changes made to the Notes Master:";

            run9.Append(runProperties10);
            run9.Append(text10);

            paragraph10.Append(run9);

            A.Paragraph paragraph11 = new A.Paragraph();
            A.EndParagraphRunProperties endParagraphRunProperties6 = new A.EndParagraphRunProperties(){ Language = "en-US", Dirty = false };

            paragraph11.Append(endParagraphRunProperties6);

            A.Paragraph paragraph12 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties6 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet1 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties6.Append(autoNumberedBullet1);

            A.Run run10 = new A.Run();

            A.RunProperties runProperties11 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties11.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text11 = new A.Text();
            text11.Text = "Added text to Header";

            run10.Append(runProperties11);
            run10.Append(text11);

            paragraph12.Append(paragraphProperties6);
            paragraph12.Append(run10);

            A.Paragraph paragraph13 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties7 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet2 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties7.Append(autoNumberedBullet2);

            A.Run run11 = new A.Run();

            A.RunProperties runProperties12 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties12.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text12 = new A.Text();
            text12.Text = "Added text to Footer";

            run11.Append(runProperties12);
            run11.Append(text12);

            paragraph13.Append(paragraphProperties7);
            paragraph13.Append(run11);

            A.Paragraph paragraph14 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties8 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet3 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties8.Append(autoNumberedBullet3);

            A.Run run12 = new A.Run();

            A.RunProperties runProperties13 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties13.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text13 = new A.Text();
            text13.Text = "Changed Font scheme to Verve";

            run12.Append(runProperties13);
            run12.Append(text13);

            paragraph14.Append(paragraphProperties8);
            paragraph14.Append(run12);

            A.Paragraph paragraph15 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties9 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet4 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties9.Append(autoNumberedBullet4);

            A.Run run13 = new A.Run();

            A.RunProperties runProperties14 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties14.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text14 = new A.Text();
            text14.Text = "Added Background Style";

            run13.Append(runProperties14);
            run13.Append(text14);

            paragraph15.Append(paragraphProperties9);
            paragraph15.Append(run13);

            A.Paragraph paragraph16 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties10 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet5 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties10.Append(autoNumberedBullet5);

            A.Run run14 = new A.Run();

            A.RunProperties runProperties15 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties15.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text15 = new A.Text();
            text15.Text = "Changed Notes page orientation to Landscape";

            run14.Append(runProperties15);
            run14.Append(text15);

            paragraph16.Append(paragraphProperties10);
            paragraph16.Append(run14);

            A.Paragraph paragraph17 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties11 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet6 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties11.Append(autoNumberedBullet6);

            A.Run run15 = new A.Run();

            A.RunProperties runProperties16 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties16.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text16 = new A.Text();
            text16.Text = "Changed Color scheme to Oriel";

            run15.Append(runProperties16);
            run15.Append(text16);

            paragraph17.Append(paragraphProperties11);
            paragraph17.Append(run15);

            A.Paragraph paragraph18 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties12 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet7 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties12.Append(autoNumberedBullet7);

            A.Run run16 = new A.Run();

            A.RunProperties runProperties17 = new A.RunProperties(){ Language = "en-US", Dirty = false };
            runProperties17.SetAttribute(new OpenXmlAttribute("", "smtClean", "", "0"));
            A.Text text17 = new A.Text();
            text17.Text = "Removed Page Number";

            run16.Append(runProperties17);
            run16.Append(text17);

            paragraph18.Append(paragraphProperties12);
            paragraph18.Append(run16);

            A.Paragraph paragraph19 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties13 = new A.ParagraphProperties(){ LeftMargin = 342900, Indent = -342900 };
            A.AutoNumberedBullet autoNumberedBullet8 = new A.AutoNumberedBullet(){ Type = A.TextAutoNumberSchemeValues.ArabicParenR };

            paragraphProperties13.Append(autoNumberedBullet8);
            A.EndParagraphRunProperties endParagraphRunProperties7 = new A.EndParagraphRunProperties(){ Language = "en-US", Dirty = false };

            paragraph19.Append(paragraphProperties13);
            paragraph19.Append(endParagraphRunProperties7);

            textBody6.Append(bodyProperties6);
            textBody6.Append(listStyle6);
            textBody6.Append(paragraph10);
            textBody6.Append(paragraph11);
            textBody6.Append(paragraph12);
            textBody6.Append(paragraph13);
            textBody6.Append(paragraph14);
            textBody6.Append(paragraph15);
            textBody6.Append(paragraph16);
            textBody6.Append(paragraph17);
            textBody6.Append(paragraph18);
            textBody6.Append(paragraph19);

            shape6.Append(nonVisualShapeProperties6);
            shape6.Append(shapeProperties6);
            shape6.Append(textBody6);

            shapeTree2.Append(nonVisualGroupShapeProperties2);
            shapeTree2.Append(groupShapeProperties2);
            shapeTree2.Append(shape6);

            commonSlideData2.Append(shapeTree2);

            ColorMapOverride colorMapOverride1 = new ColorMapOverride();
            A.MasterColorMapping masterColorMapping1 = new A.MasterColorMapping();

            colorMapOverride1.Append(masterColorMapping1);

            slide1.Append(commonSlideData2);
            slide1.Append(colorMapOverride1);

            slidePart1.Slide = slide1;
        }