Exemplo n.º 1
0
Arquivo: Word.cs Projeto: Zagii/EAkzg
        public Wordy.Paragraph wstawParagraf(String txt, string styl, Wordy.WdOutlineLevel poziom = Wordy.WdOutlineLevel.wdOutlineLevelBodyText, String komentarz = "")
        {
            //Insert another paragraph.
            Wordy.Paragraph oPara3;

            oPara3 = doc.Content.Paragraphs.Add();
            oPara3.Range.set_Style(styl);
            //usunwamy znaczniki htmla z formatowania
            //    txt=usunNieobslugiwaneZnacznikiHtml(txt); <<< pytanie co się zwali
            //    txt=kowertujZnacznikiHTML(txt); <<pytanie co się zwali
            oPara3.Range.Text = txt;
            if (komentarz != "")
            {
                {
                    oPara3.Range.Comments.Add(oPara3.Range, komentarz);
                }
            }

            oPara3.OutlineLevel = poziom;

            if (stylNorm == styl)
            {
                oPara3.Format.SpaceAfter  = 0;
                oPara3.Format.SpaceBefore = 0;
            }
            if (stylPodpis == styl)
            {
                oPara3.Format.SpaceBefore = 0;
            }
            if (stylPodrozdz == styl)
            {
                oPara3.Format.SpaceBefore = 36;
            }
            if (stylPodrozdz2 == styl)
            {
                oPara3.Format.SpaceBefore = 24;
            }
            if (stylPodrozdz3 == styl)
            {
                oPara3.Format.SpaceBefore = 12;
            }
            if (stylRozdz == styl)
            {
                oPara3.Format.SpaceBefore = 48;
            }

            oPara3.Range.set_Style(styl);
            oPara3.Range.InsertParagraphAfter();
            return(oPara3);
        }
Exemplo n.º 2
0
Arquivo: Word.cs Projeto: Zagii/EAkzg
        public Wordy.Paragraph wstawParagraf(String txt, int h, String komentarz = "")
        {
            Wordy.Paragraph parWynik = null;
            string          styl_txt = stylNorm;

            txt = txt.Replace("\r", "");
            Wordy.WdOutlineLevel poziom = Wordy.WdOutlineLevel.wdOutlineLevelBodyText;

            if (h == 1)
            {
                styl_txt = stylRozdz;
                poziom   = Wordy.WdOutlineLevel.wdOutlineLevel1;
            }
            if (h == 2)
            {
                styl_txt = stylPodrozdz;
                poziom   = Wordy.WdOutlineLevel.wdOutlineLevel2;
            }
            if (h == 3)
            {
                styl_txt = stylPodrozdz2;
                poziom   = Wordy.WdOutlineLevel.wdOutlineLevel3;
            }
            if (h == 4)
            {
                styl_txt = stylPodrozdz3;
                poziom   = Wordy.WdOutlineLevel.wdOutlineLevel4;
            }
            string[] paragrafy = txt.Split('\n');
            int      i         = 0;

            foreach (string s in paragrafy)
            {
                parWynik = wstawParagraf(paragrafy[i], styl_txt, poziom, komentarz);
                i++;
            }
            return(parWynik);
        }