コード例 #1
0
ファイル: ThemeTest.cs プロジェクト: yuekunge/Open-XML-SDK
        public void Theme01EditAttribute()
        {
            this.MyTestInitialize(TestContext.GetCurrentMethod());
            try
            {
                string originalFilepath = this.GetTestFilePath(this.generateDocumentFilePath);
                string editFilePath     = this.GetTestFilePath(this.editDocumentFilePath);

                System.IO.File.Copy(originalFilepath, editFilePath, true);

                // Adding ThemeId
                using (PresentationDocument doc = PresentationDocument.Open(editFilePath, true))
                {
                    try
                    {
                        doc.PresentationPart.SlideMasterParts.First().ThemePart.Theme.ThemeId =
                            new DocumentFormat.OpenXml.StringValue("TEST");
                    }
                    catch (Exception e)
                    {
                        this.Log.Fail(e.Message);
                    }
                }

                TestEntities testEntities = new TestEntities();
                testEntities.EditAttribute(editFilePath, this.Log);
                testEntities.VerifyAttribute(editFilePath, this.Log);
            }
            catch (Exception e)
            {
                this.Log.Fail(e.Message);
            }
        }
コード例 #2
0
ファイル: ThemeTest.cs プロジェクト: thundertd/Open-XML-SDK
        public void Theme01EditAttribute()
        {
            using (var stream = new MemoryStream())
            {
                GeneratedDocument.CreatePackage(stream);

                // Adding ThemeId
                using (PresentationDocument doc = PresentationDocument.Open(stream, true))
                {
                    doc.PresentationPart.SlideMasterParts.First().ThemePart.Theme.ThemeId = new StringValue("TEST");
                }

                TestEntities testEntities = new TestEntities();
                testEntities.EditAttribute(stream, Log);
                testEntities.VerifyAttribute(stream, Log);
            }
        }
コード例 #3
0
ファイル: ThemeTest.cs プロジェクト: stengfei/Open-XML-SDK
        public void Theme01EditAttribute()
        {
            string originalFilepath = GetTestFilePath(generateDocumentFilePath);
            string editFilePath     = GetTestFilePath(editDocumentFilePath);

            System.IO.File.Copy(originalFilepath, editFilePath, true);

            // Adding ThemeId
            using (PresentationDocument doc = PresentationDocument.Open(editFilePath, true))
            {
                doc.PresentationPart.SlideMasterParts.First().ThemePart.Theme.ThemeId =
                    new DocumentFormat.OpenXml.StringValue("TEST");
            }

            TestEntities testEntities = new TestEntities();

            testEntities.EditAttribute(editFilePath, Log);
            testEntities.VerifyAttribute(editFilePath, Log);
        }
コード例 #4
0
ファイル: ThemeTest.cs プロジェクト: eriawan/Open-XML-SDK
        public void Theme01EditAttribute()
        {
            this.MyTestInitialize(TestContext.GetCurrentMethod());
            try
            {
                string originalFilepath = this.GetTestFilePath(this.generateDocumentFilePath);
                string editFilePath = this.GetTestFilePath(this.editDocumentFilePath);

                System.IO.File.Copy(originalFilepath, editFilePath, true);

                // Adding ThemeId
                using (PresentationDocument doc = PresentationDocument.Open(editFilePath, true))
                {
                    try
                    {
                        doc.PresentationPart.SlideMasterParts.First().ThemePart.Theme.ThemeId =
                            new DocumentFormat.OpenXml.StringValue("TEST");
                    }
                    catch (Exception e)
                    {
                        this.Log.Fail(e.Message);
                    }
                }

                TestEntities testEntities = new TestEntities();
                testEntities.EditAttribute(editFilePath, this.Log);
                testEntities.VerifyAttribute(editFilePath, this.Log);
            }
            catch (Exception e)
            {
                this.Log.Fail(e.Message);
            }
        }