コード例 #1
0
        public Paragraph(uint leftIntendation = 0, uint rightIntendation = 0, JUSTIFICATION justification = JUSTIFICATION.NONE)
        {
            _Paragraph = new Wp.Paragraph()
            {
                RsidParagraphMarkRevision = "00297913",
                RsidParagraphAddition     = "00297913",
                RsidParagraphProperties   = "00297913",
                RsidRunAdditionDefault    = "0074062A",
                ParagraphId = "29551F12",
                TextId      = "11181D94"
            };

            Wp.ParagraphProperties _pp = new Wp.ParagraphProperties();
            Wp.Indentation         _i  = new Wp.Indentation()
            {
                Left  = leftIntendation.ToString(),
                Right = rightIntendation.ToString()
            };
            _pp.Append(_i);

            if (justification.Equals(JUSTIFICATION.NONE) is false)
            {
                Wp.Justification _j;
                if (justification.Equals(JUSTIFICATION.CENTER) is true)
                {
                    _j = new Wp.Justification()
                    {
                        Val = Wp.JustificationValues.Center
                    }
                }
                ;
                else if (justification.Equals(JUSTIFICATION.LEFT) is true)
                {
                    _j = new Wp.Justification()
                    {
                        Val = Wp.JustificationValues.Left
                    }
                }
                ;
                else
                {
                    _j = new Wp.Justification()
                    {
                        Val = Wp.JustificationValues.Right
                    }
                };

                _pp.Append(_j);
            }

            _Paragraph.Append(_pp);
        }
コード例 #2
0
        public Models.Parts.Paragraphs.Style.Indentation ParseIndentation(DocumentFormat.OpenXml.Wordprocessing.Indentation indent)
        {
            var result = new Models.Parts.Paragraphs.Style.Indentation();

            if (indent == null)
            {
                return(result);
            }

            if (indent.Left != null && indent.Left.HasValue)
            {
                result.Left = Convert.ToInt32(double.Parse(indent.Left.Value) / 210.0);
            }
            if (indent.LeftChars != null && indent.LeftChars.HasValue)
            {
                result.Left = indent.LeftChars.Value;
            }

            if (indent.Right != null && indent.Right.HasValue)
            {
                result.Right = Convert.ToInt32(double.Parse(indent.Right.Value) / 210.0);
            }
            if (indent.RightChars != null && indent.LeftChars.HasValue)
            {
                result.Right = indent.RightChars.Value;
            }

            if (indent.FirstLine != null && indent.FirstLine.HasValue)
            {
                result.FirstLine = Convert.ToInt32(double.Parse(indent.FirstLine.Value) / 210.0);
            }
            if (indent.FirstLineChars != null && indent.FirstLineChars.HasValue)
            {
                result.FirstLine = indent.FirstLineChars.Value;
            }

            return(result);
        }