예제 #1
0
        public void TestMathFormulaWithRef()
        {
            try
            {

                OXMLDocWrap doc = new OXMLDocWrap();
                doc.OpenDocument(@"..\..\test\TestModule.docx");

                    OXMLTableWrap table = new OXMLTableWrap(2, 1, doc.TableStyles.Find(x => x.StyleID =="a5"), null);

                    table.Rows[0].setHeightWithRule(2, OXMLHeightRuleValues.Auto);

                    table.GetCell(0, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;
                    table.GetCell(1, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;

                    table.Columns[0].Width = 16.0f;
                    table.Columns[1].Width = 1.0f;

                    table.GetCell(0, 0).margins.LeftMargin = 12;
                    doc.AddMathFormulaToParagraph(table.GetCell(0, 0).paragraph, @"F=\SUP((\FRAC(1)(2)))(4)+1");

                    table.GetCell(1, 0).paragraph.AddText("(1)");

                    var param = new OXMLTableBorderParam();
                    param.bVal = "None";
                    param.bColor = "auto";
                    param.bSpace = 0;
                    param.bSize = 0;

                    table.borders.AllBorders = param;
                    doc.AddTable(table);

                doc.CloseDocument();

            } catch (Exception e)
            {
                Assert.Fail("EXCEPT: " + e.Message);
            }

            Assert.Pass();
        }
예제 #2
0
        public void TagsTest()
        {
            try
            {

                OXMLDocWrap doc = new OXMLDocWrap();
                doc.OpenDocument(@"..\..\test\TestModule.docx");

                doc.SetParentBlockToAdd("PlaceTag001");

                var par = new OXMLParagraphWrap();

                doc.AddMathFormulaToParagraph(par, @"\SUB(12)(2)");
                doc.AddParagraph(par);

                doc.CloseDocument();

            } catch (Exception e)
            {
                Assert.Fail("EXCEPT: " + e.Message);
            }

            Assert.Pass();
        }