Exemplo n.º 1
0
        public void copy2(docPubScheme oth)
        {
            oth.strSchemeName = strSchemeName;
            oth.nTocEnable    = nTocEnable;
            oth.tocFnt.clone(tocFnt);
            oth.tocParaFmt.clone(tocParaFmt);
            oth.tocStyles.clone(tocStyles);

            oth.bHdSnsEnable = bHdSnsEnable;
            oth.hdSnFnt.clone(hdSnFnt);

            headingSn hdSn = null, ohdSn = null;
            int       nCnt = oth.hdSns.Count;

            for (int i = 0; i < nCnt; i++)
            {
                hdSn  = (headingSn)hdSns[i];
                ohdSn = (headingSn)oth.hdSns[i];

                ohdSn.clone(hdSn);
            }

            oth.bHdStylesEnable = bHdStylesEnable;
            oth.hdStyleFnt.clone(hdStyleFnt);
            oth.hdStyleParaFmt.clone(hdStyleParaFmt);

            headingStyle hdStyle = null, ohdStyle = null;

            nCnt = oth.hdStyles.Count;
            for (int i = 0; i < nCnt; i++)
            {
                hdStyle  = (headingStyle)hdStyles[i];
                ohdStyle = (headingStyle)oth.hdStyles[i];

                ohdStyle.clone(hdStyle);
            }

            oth.nTizhuEnable = nTizhuEnable;
            oth.tizhuFnt.clone(tizhuFnt);
            oth.tizhuParaFmt.clone(tizhuParaFmt);

            oth.tblTizhuStyle.clone(tblTizhuStyle);
            oth.inShpTizhuStyle.clone(inShpTizhuStyle);


            oth.bTblEnable = bTblEnable;
            oth.tblFont.clone(tblFont);
            //oth.tblEveryParaFmt.clone(tblEveryParaFmt);
            oth.tblParaFmt.clone(tblParaFmt);

            oth.bInShpEnable = bInShpEnable;
            oth.inShpParaFmt.clone(inShpParaFmt);


            oth.nListParaEnable = nListParaEnable;
            oth.listParaFnt.clone(listParaFnt);
            oth.listParaParaFmt.clone(listParaParaFmt);
            oth.outTblListParaStyle.clone(outTblListParaStyle);
            oth.inTblListParaStyle.clone(inTblListParaStyle);

            oth.nTextBodyEnable = nTextBodyEnable;
            oth.textBodyFnt.clone(textBodyFnt);
            oth.textBodyParaFmt.clone(textBodyParaFmt);

            oth.outTblTextBodyStyle.clone(outTblTextBodyStyle);
            oth.inTblTextBodyStyle.clone(inTblTextBodyStyle);


            oth.nPgNumEnable = nPgNumEnable;
            oth.pgNumStyle.clone(pgNumStyle);

            pageNumStyle pgNum = null, opgNum = null;

            nCnt = oth.pgNumStyles.Count;

            for (int i = 0; i < nCnt; i++)
            {
                pgNum  = (pageNumStyle)pgNumStyles[i];
                opgNum = (pageNumStyle)oth.pgNumStyles[i];

                //
                opgNum.clone(pgNum);
            }

            return;
        }
Exemplo n.º 2
0
        public docPubScheme()
        {
            Word.Application app = Globals.ThisAddIn.Application;

            strSchemeName = "";

            nTocEnable = 2;
            tocFnt     = new nhFont();
            tocParaFmt = new nhParaFmt();
            tocStyles  = new tocStyle();

            bHdSnsEnable = true;
            hdSnFnt      = new nhFont();
            hdSns        = new List <headingSn>();
            for (int i = 0; i < 9; i++)
            {
                headingSn hsn = new headingSn();

                fillHeadingSnDefault(hsn, i);

                hdSns.Add(hsn);
            }

            bHdStylesEnable = true;
            hdStyleFnt      = new nhFont();
            hdStyleParaFmt  = new nhParaFmt();

            hdStyles = new List <headingStyle>();
            for (int i = 0; i < 9; i++)
            {
                headingStyle hs = new headingStyle();
                fillHeadingStyleDefault(hs, i, @"宋体");
                hdStyles.Add(hs);
            }

            nTizhuEnable = 2;
            tizhuFnt     = new nhFont();
            tizhuParaFmt = new nhParaFmt();

            tblTizhuStyle   = new tizhuStyle();
            inShpTizhuStyle = new tizhuStyle();


            bTblEnable = true;
            tblFont    = new nhFont();
            //tblEveryParaFmt = new nhParaFmt();
            tblParaFmt = new nhParaFmt();

            bInShpEnable = true;
            inShpParaFmt = new nhParaFmt();


            nListParaEnable = 2;
            listParaFnt     = new nhFont();
            listParaParaFmt = new nhParaFmt();

            outTblListParaStyle = new listParaStyle();
            inTblListParaStyle  = new listParaStyle();

            //
            nTextBodyEnable = 2;
            textBodyFnt     = new nhFont();
            textBodyParaFmt = new nhParaFmt();

            outTblTextBodyStyle = new textBodyStyle();
            inTblTextBodyStyle  = new textBodyStyle();


            nPgNumEnable = 2;
            pgNumStyle   = new pageNumStyle();

            pgNumStyles = new List <pageNumStyle>();
            for (int i = 0; i < 9; i++)
            {
                pageNumStyle pg = new pageNumStyle();
                pgNumStyles.Add(pg);
            }


            m_hashSnStyle2Name.Clear();
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleNone, "");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleArabic, "1");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleUppercaseRoman, "I");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleLowercaseRoman, "i");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleUppercaseLetter, "A");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleLowercaseLetter, "a");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleSimpChinNum3, "一");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleSimpChinNum2, "壹");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleZodiac1, "甲");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleZodiac2, "子");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleOrdinal, "1st");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleCardinalText, "One");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleOrdinalText, "First");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleArabicLZ, "01");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleLegalLZ, "01");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleLegal, "1");
            m_hashSnStyle2Name.Add(Word.WdListNumberStyle.wdListNumberStyleNumberInCircle, "①");

            return;
        }
Exemplo n.º 3
0
        public void clone(docPubScheme oth)
        {
            strSchemeName = oth.strSchemeName;

            nTocEnable = oth.nTocEnable;
            tocFnt.clone(oth.tocFnt);
            tocParaFmt.clone(oth.tocParaFmt);
            tocStyles.clone(oth.tocStyles);

            bHdSnsEnable = oth.bHdSnsEnable;
            hdSnFnt.clone(oth.hdSnFnt);
            headingSn hdSn = null, ohdSn = null;
            int       nCnt = hdSns.Count;

            for (int i = 0; i < nCnt; i++)
            {
                hdSn  = (headingSn)hdSns[i];
                ohdSn = (headingSn)oth.hdSns[i];

                hdSn.clone(ohdSn);
            }

            bHdStylesEnable = oth.bHdStylesEnable;
            hdStyleFnt.clone(oth.hdStyleFnt);
            hdStyleParaFmt.clone(oth.hdStyleParaFmt);

            headingStyle hdStyle = null, ohdStyle = null;

            nCnt = hdStyles.Count;
            for (int i = 0; i < nCnt; i++)
            {
                hdStyle  = (headingStyle)hdStyles[i];
                ohdStyle = (headingStyle)oth.hdStyles[i];

                hdStyle.clone(ohdStyle);
            }

            nTizhuEnable = oth.nTizhuEnable;
            tizhuFnt.clone(oth.tizhuFnt);
            tizhuParaFmt.clone(oth.tizhuParaFmt);

            tblTizhuStyle.clone(oth.tblTizhuStyle);
            inShpTizhuStyle.clone(oth.inShpTizhuStyle);

            //
            bTblEnable = oth.bTblEnable;
            tblFont.clone(oth.tblFont);
            //tblEveryParaFmt.clone(oth.tblEveryParaFmt);
            tblParaFmt.clone(oth.tblParaFmt);

            bInShpEnable = oth.bInShpEnable;
            inShpParaFmt.clone(oth.inShpParaFmt);


            nListParaEnable = oth.nListParaEnable;
            listParaFnt.clone(oth.listParaFnt);
            listParaParaFmt.clone(oth.listParaParaFmt);
            outTblListParaStyle.clone(oth.outTblListParaStyle);
            inTblListParaStyle.clone(oth.inTblListParaStyle);

            nTextBodyEnable = oth.nTextBodyEnable;
            textBodyFnt.clone(oth.textBodyFnt);
            textBodyParaFmt.clone(oth.textBodyParaFmt);

            outTblTextBodyStyle.clone(oth.outTblTextBodyStyle);
            inTblTextBodyStyle.clone(oth.inTblTextBodyStyle);


            nPgNumEnable = oth.nPgNumEnable;
            pgNumStyle.clone(oth.pgNumStyle);

            pageNumStyle pgNum = null, opgNum = null;

            nCnt = pgNumStyles.Count;

            for (int i = 0; i < nCnt; i++)
            {
                pgNum  = (pageNumStyle)pgNumStyles[i];
                opgNum = (pageNumStyle)oth.pgNumStyles[i];

                //
                pgNum.clone(opgNum);
            }

            return;
        }
Exemplo n.º 4
0
        public void fillHeadingStyleDefault(headingStyle hs, int nIndex, String strFntName)
        {
            String[] strArrFntNameBi = new String[] {
                "Times New Roman",
                "+标题 CS",
                "+正文 CS 字体",
                "+标题 CS",
                "+正文 CS 字体",
                "+标题 CS",
                "+正文 CS 字体",
                "+标题 CS",
                "+标题 CS",
                "+正文 CS 字体"
            };

            /*
             * float[] fArrFntSize = new float[] {
             *  36,26,24,22,18,16,15,14,12,10.0f
             * };*/

            float[] fArrFntSize = new float[] {
                22.0f, 16.0f, 16.0f, 14.0f, 14.0f, 12.0f, 12.0f, 12.0f, 10f, 10f
            };

            /*
             * 标题1:中文正文,宋体,2号,加粗
             * 标题2:宋体,3号,加粗
             * 标题3:宋体,3号,加粗
             * 标题4:宋体,4号,加粗
             * 标题5:宋体,4号,加粗
             * 标题6:宋体,小四号,加粗
             * 标题7:宋体,小四号,加粗
             * 标题8:宋体,小四
             * 标题9:宋体,5号
             * 正文:宋体,5号
             */

            float[] fArrFntKerning = new float[] {
                16, 1, 1, 1, 1, 1, 1, 1, 1, 1
            };


            // float[] fArrParaFmtLineSpacing = new float[]{
            //    12,20.8f,20.8f,18.8f,18.8f,16,16,16,16,12
            // };

            float[] fArrParaFmtLineSpacing = new float[] {
                12.0f, 12.0f, 12.0f, 12.0f, 12.0f, 12.0f, 12.0f, 12.0f, 12.0f, 12.0f
            };

            float[] fArrParaFmtSpaceBefore = new float[] {
                5, 13, 13, 14, 14, 12, 12, 12, 12, 0
            };

            float[] fArrParaFmtSpaceAfter = new float[] {
                5, 13, 13, 14.5f, 14.5f, 3.2f, 3.2f, 3.2f, 3.2f, 0
            };

            int i = nIndex;

            hs.Fnt.Color          = (int)Word.WdColor.wdColorAutomatic; // -16777216;
            hs.Fnt.UnderlineColor = (int)Word.WdColor.wdColorAutomatic; // -16777216;
            hs.Fnt.DiacriticColor = (int)(Word.WdColor)Word.WdConstants.wdUndefined;

            hs.Fnt.Name        = strFntName;
            hs.Fnt.NameFarEast = strFntName;
            hs.Fnt.NameAscii   = strFntName;//"+西文正文";
            //hs[i].m_fnt.NameOther = strFntName;//"+西文正文";

            hs.Fnt.NameBi = strArrFntNameBi[i];

            hs.Fnt.Size   = fArrFntSize[i];
            hs.Fnt.SizeBi = fArrFntSize[i];


            hs.Fnt.Kerning = fArrFntKerning[i];
            hs.Fnt.Scaling = 100;


            // paragraph format

            hs.ParaFmt.OutlineLevel = (int)((Word.WdOutlineLevel)(i + 1));
            hs.ParaFmt.AddSpaceBetweenFarEastAndAlpha = -1;
            hs.ParaFmt.AddSpaceBetweenFarEastAndDigit = -1;
            hs.ParaFmt.Alignment                       = (int)Word.WdParagraphAlignment.wdAlignParagraphLeft;
            hs.ParaFmt.AutoAdjustRightIndent           = -1;
            hs.ParaFmt.BaseLineAlignment               = (int)Word.WdBaselineAlignment.wdBaselineAlignAuto; // 4
            hs.ParaFmt.CharacterUnitFirstLineIndent    = 0;
            hs.ParaFmt.CharacterUnitLeftIndent         = 0;
            hs.ParaFmt.CharacterUnitRightIndent        = 0;
            hs.ParaFmt.DisableLineHeightGrid           = 0;
            hs.ParaFmt.FarEastLineBreakControl         = -1;
            hs.ParaFmt.FirstLineIndent                 = 0;
            hs.ParaFmt.HalfWidthPunctuationOnTopOfLine = 0;
            hs.ParaFmt.HangingPunctuation              = -1;
            hs.ParaFmt.Hyphenation                     = -1;

            if (i < 9)
            {
                hs.ParaFmt.KeepTogether = -1;
                hs.ParaFmt.KeepWithNext = -1;
            }
            else
            {
                hs.ParaFmt.KeepTogether = 0;
                hs.ParaFmt.KeepWithNext = 0;
            }


            hs.ParaFmt.LeftIndent       = 0;
            hs.ParaFmt.LineSpacing      = fArrParaFmtLineSpacing[i];
            hs.ParaFmt.LineSpacingRule  = (int)Word.WdLineSpacing.wdLineSpaceSingle;//Word.WdLineSpacing.wdLineSpaceMultiple; // 5
            hs.ParaFmt.LineUnitAfter    = 0;
            hs.ParaFmt.LineUnitBefore   = 0;
            hs.ParaFmt.MirrorIndents    = 0;
            hs.ParaFmt.NoLineNumber     = 0;
            hs.ParaFmt.PageBreakBefore  = 0;
            hs.ParaFmt.ReadingOrder     = (int)Word.WdReadingOrder.wdReadingOrderLtr; // 1
            hs.ParaFmt.RightIndent      = 0;
            hs.ParaFmt.SpaceAfter       = fArrParaFmtSpaceAfter[i];
            hs.ParaFmt.SpaceAfterAuto   = 0; // [0] = -1, others = 0
            hs.ParaFmt.SpaceBefore      = fArrParaFmtSpaceBefore[i];
            hs.ParaFmt.SpaceBeforeAuto  = 0; // [0] = -1, others = 0
            hs.ParaFmt.TextboxTightWrap = 0;
            hs.ParaFmt.WidowControl     = 0; // [0] = -1, others = 0
            hs.ParaFmt.WordWrap         = -1;

            return;
        }