public static Paragraph Paragraph(HorizontalAlignmentType horizontalAlignment, params Run[] runs)
        {
            var paragraph = Paragraph(runs);

            paragraph.HorizontalTextAlignment = horizontalAlignment;
            return(paragraph);
        }
示例#2
0
 public TextAlignment(CgmFile container, HorizontalAlignmentType horz, VerticalAlignmentType vert, double continousHorz, double continousVert)
     : this(container)
 {
     HorizontalAlignment           = horz;
     VerticalAlignment             = vert;
     ContinuousHorizontalAlignment = continousHorz;
     ContinuousVerticalAlignment   = continousVert;
 }
示例#3
0
 /// <summary>
 /// Sets the alignment on a cell.<br />
 /// Cells without calling this function have the default values of left and top respectively.<br />
 /// </summary>
 /// <param name="position">The cell to set alignment on.</param>
 /// <param name="horizontal">The horizontal alignment.</param>
 /// <param name="vertical">The vertical alignment.</param>
 /// <since_tizen> 3 </since_tizen>
 public void SetCellAlignment(TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
 {
     Interop.TableView.TableView_SetCellAlignment(swigCPtr, TableView.CellPosition.getCPtr(position), (int)horizontal, (int)vertical);
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
示例#4
0
文件: Style.cs 项目: Jonesb/PolReader
        public Style(HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment, string bgColor)
        {
            HorizontalAlignment = horizontalAlignment;
            VerticalAlignment   = verticalAlignment;

            BorderColor = "";
            BGColor     = bgColor;
            FontColor   = "";
            FontName    = "";
        }
示例#5
0
 internal static void SetParagraphAlignment(Paragraph paragraph, HorizontalAlignmentType alignment)
 {
     // Set picture alignment
     if (alignment == HorizontalAlignmentType.Center)
         paragraph.ParagraphProperties.Append(new Justification() { Val = JustificationValues.Center });
     else if (alignment == HorizontalAlignmentType.Right)
         paragraph.ParagraphProperties.Append(new Justification() { Val = JustificationValues.Right });
     else
         paragraph.ParagraphProperties.Append(new Justification() { Val = JustificationValues.Left });
 }
        public static Paragraph Align(this Paragraph source, HorizontalAlignmentType horizontal, VerticalTextAlignment vertical)
        {
            if (source is null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            source.VerticalTextAlignment   = vertical;
            source.HorizontalTextAlignment = horizontal;
            return(source);
        }
示例#7
0
        private static double GetXOffset(HorizontalAlignmentType horizontalAlignment, double width)
        {
            switch (horizontalAlignment)
            {
            case HorizontalAlignmentType.Left:
                return(-0.5 * width);

            case HorizontalAlignmentType.Right:
                return(0.5 * width);
            }
            return(0);
        }
示例#8
0
        internal void CreateTextParagraph(WordprocessingDocument package, string style, HorizontalAlignmentType alignment, string text, FormatStyle formatStyle)
        {
            Body body = package.MainDocumentPart.Document.Body;

            if (!string.IsNullOrEmpty(style) && !WordHelper.IsStyleIdInDocument(package, style)) {

                throw new System.ArgumentOutOfRangeException(style);
            }

            Run textRun = new Run();

            if (formatStyle != null) {

                // Get a reference to the RunProperties object.
                RunProperties runProperties = textRun.AppendChild(new RunProperties());

                if (formatStyle.IsBold) {

                    Bold bold = new Bold();
                    //bold.Val = OnOffValue.FromBoolean(true);
                    runProperties.AppendChild(bold);
                }
            }

            textRun.AppendChild(new Text(text));

            // Add a paragraph with a run and some text.
            Paragraph newParagraph = new Paragraph(textRun);

            // If the paragraph has no ParagraphProperties object, create one.
            WordHelper.CreateParagraphPropertiesIfNonExists(newParagraph);

            // Set paragraph alignment
            WordHelper.SetParagraphAlignment(newParagraph, alignment);

            if (!string.IsNullOrEmpty(style)) {

                // Get a reference to the ParagraphProperties object.
                ParagraphProperties pPr = newParagraph.ParagraphProperties;

                // If a ParagraphStyleId object doesn't exist, create one.
                if (pPr.ParagraphStyleId == null)
                    pPr.ParagraphStyleId = new ParagraphStyleId();

                // Set the style of the paragraph.
                pPr.ParagraphStyleId.Val = style;
            }

            // Append new paragraph
            body.AppendChild(newParagraph);
        }
示例#9
0
        internal void InsertPicture(string picturePath, decimal resizablePercent, HorizontalAlignmentType alignment)
        {
            if (resizablePercent < 0.0M)
                throw new ArgumentOutOfRangeException("resizablePercent", "The resizable percent is lower than 0.0M. Define a value between 0.0M and 1.0M.");
            if (resizablePercent > 1.0M)
                throw new ArgumentOutOfRangeException("resizablePercent", "The resizable percent is grower than 1.0M. Define a value between 0.0M and 1.0M.");

            MainDocumentPart mainPart = this._package.MainDocumentPart;

            var imagePartId = CreateImagePart(mainPart, picturePath);

            ImageSize imageSize = GetOriginalSize(picturePath, resizablePercent);

            AddImageToBody(imagePartId, Path.GetFileName(picturePath), imageSize, alignment);
        }
示例#10
0
文件: Style.cs 项目: Jonesb/PolReader
        public Style(HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment, string bgColor, string borderColor, bool borderTop, bool borderBottom, bool borderLeft, bool borderRight)
        {
            HorizontalAlignment = horizontalAlignment;
            VerticalAlignment   = verticalAlignment;

            BorderColor = borderColor;
            BGColor     = bgColor;
            FontColor   = "";
            FontName    = "";

            BorderTop    = borderTop;
            BorderBottom = borderBottom;
            BorderLeft   = borderLeft;
            BorderRight  = borderRight;

            BorderLine = BorderLineType.Continuous;
        }
示例#11
0
        private void AddImageToBody(string relationshipId, string name, ImageSize imageSize, HorizontalAlignmentType alignment)
        {
            Body body = this._package.MainDocumentPart.Document.Body;

            var element = CreateDrawingElement(relationshipId, name, imageSize);

            var pictureParagraph = new Paragraph(new Run(element));

            // If the paragraph has no ParagraphProperties object, create one.
            WordHelper.CreateParagraphPropertiesIfNonExists(pictureParagraph);

            // Set paragraph alignment
            WordHelper.SetParagraphAlignment(pictureParagraph, alignment);

            // Append the reference to body, the element should be in a Run.
            body.AppendChild(pictureParagraph);
        }
示例#12
0
 public void CreateTextParagraph(WordprocessingDocument package, TextParagraphType paragraphType, HorizontalAlignmentType alignment, string text, FormatStyle formatStyle)
 {
     switch (paragraphType) {
         case TextParagraphType.Title:
             CreateTextParagraph(package, StyleCreator.TitleStyle, alignment, text, formatStyle);
             break;
         case TextParagraphType.Normal:
             CreateTextParagraph(package, StyleCreator.NormalStyle, alignment, text, formatStyle);
             break;
         case TextParagraphType.Heading1:
             CreateTextParagraph(package, StyleCreator.HeadingOneStyle, alignment, text, formatStyle);
             break;
         case TextParagraphType.Heading2:
             CreateTextParagraph(package, StyleCreator.HeadingTwoStyle, alignment, text, formatStyle);
             break;
         case TextParagraphType.Heading3:
             CreateTextParagraph(package, StyleCreator.HeadingThreeStyle, alignment, text, formatStyle);
             break;
         case TextParagraphType.None:
         default:
             CreateTextParagraph(package, string.Empty, alignment, text, formatStyle);
             break;
     }
 }
示例#13
0
 public void SetCellHorizoltalAllign(int rowIndex, int columnIndex, HorizontalAlignmentType type)
 {
     _excelDocument.SetCellHorizoltalAllign(rowIndex, columnIndex, type);
 }
示例#14
0
 public void AddImage(string picturePath, decimal resizablePercent, HorizontalAlignmentType alignment)
 {
     var imageCreator = new ImageCreator(this._package);
     imageCreator.InsertPicture(picturePath, resizablePercent, alignment);
 }
示例#15
0
 public void SetCellAlignment(Tizen.NUI.BaseComponents.TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
 {
     tableView.SetCellAlignment(position, horizontal, vertical);
 }
示例#16
0
 public void CreateTextParagraph(TextParagraphType paragraphType, HorizontalAlignmentType alignment, string text, FormatStyle formatStyle)
 {
     var titleCreator = new ParagraphCreator();
     titleCreator.CreateTextParagraph(this._package, paragraphType, alignment, text, formatStyle);
 }
 public HorizontalPositionType() {
     this.offsetField = 0;
     this.unitField = UnitType.Points;
     this.alignmentField = HorizontalAlignmentType.Center;
 }
示例#18
0
        private static void SetTableAlignment(HorizontalAlignmentType alignment, TableProperties tblProp)
        {
            TableJustification tblJustification = null;

            if (alignment == HorizontalAlignmentType.Center) {

                tblJustification = new TableJustification() { Val = TableRowAlignmentValues.Center };
            }
            else if (alignment == HorizontalAlignmentType.Right) {

                tblJustification = new TableJustification() { Val = TableRowAlignmentValues.Right };
            }
            else {

                tblJustification = new TableJustification() { Val = TableRowAlignmentValues.Left };
            }

            tblProp.Append(tblJustification);
        }
示例#19
0
 public void AddImage(string picturePath, HorizontalAlignmentType alignment)
 {
     var imageCreator = new ImageCreator(this._package);
     imageCreator.InsertPicture(picturePath, 1.0M, alignment);
 }
示例#20
0
 public static void SetScreenPosition(View view, Point screenPosition,
                                      HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment)
 {
     view.SetX((int)(screenPosition.X - 0.5 * view.Width + GetXOffset(horizontalAlignment, view.Width)));
     view.SetY((int)(screenPosition.Y - 0.5 * view.Height + GetYOffset(verticalAlignment, view.Height)));
 }
示例#21
0
 public void CreateTextParagraph(WordprocessingDocument package, TextParagraphType paragraphType, HorizontalAlignmentType alignment, string text)
 {
     CreateTextParagraph(package, paragraphType, alignment, text, null);
 }
示例#22
0
        public static void SetCellHorizoltalAllign(this SLDocument excelDocument, int rowIndex, int columnIndex, HorizontalAlignmentType type)
        {
            var cellStyle = excelDocument.GetCellStyle(rowIndex, columnIndex);

            switch (type)
            {
            case HorizontalAlignmentType.Left:
                cellStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Left);
                break;

            case HorizontalAlignmentType.Right:
                cellStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Right);
                break;

            case HorizontalAlignmentType.Center:
                cellStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Center);
                break;

            case HorizontalAlignmentType.Justify:
                cellStyle.SetHorizontalAlignment(HorizontalAlignmentValues.Justify);
                break;
            }

            excelDocument.SetCellStyle(rowIndex, columnIndex, cellStyle);
        }
 public static Paragraph SetHorizontalAlignment(this Paragraph source, HorizontalAlignmentType alignment)
 {
     source.HorizontalTextAlignment = alignment;
     return(source);
 }
示例#24
0
        ////internal void SetForegroundColour(string contentColour)
        ////{
        ////    ((IGnosisContentControlImplementation)ControlImplementation).SetForegroundColour(contentColour);
        ////}

        protected virtual void SetDisplayDimensions()
        {
            string font     = EntityController.GetNormalStyle().Font;
            int    fontSize = EntityController.GetNormalStyle().FontSize;

            if (ControlImplementation is IGnosisDisplayCharsPossessor)
            {
                characterWidth = GlobalData.Singleton.StyleHelper.GetCharacterWidth((IGnosisContentControlImplementation)ControlImplementation, EntityController.GetNormalStyle().Font, EntityController.GetNormalStyle().FontSize);

                //display chars
                if (MinDisplayChars == 0)
                {
                    if (this.Dataset == null || this.DatasetItem == null)
                    {
                        GlobalData.Singleton.ErrorHandler.HandleError("Dataset or DatasetItem not defined for " + this.ControlImplementation.GnosisName + " " + ControlTypeMapping.GetControlTypeName(this.GetType()), "GnosisContentController");
                    }
                    else
                    {
                        MinDisplayChars = EntityController.GetMinDisplayChars(Dataset, DatasetItem);
                    }
                }

                if (MaxDisplayChars == 0)
                {
                    MaxDisplayChars = EntityController.GetMaxDisplayChars(Dataset, DatasetItem);
                }


                //field width

                if (MaxDisplayChars > 0)
                {
                    //MaxFieldWidth = StyleManager.GetMaxFieldWidth(MaxDisplayChars);
                    MaxFieldWidth = GlobalData.Singleton.StyleHelper.GetMaxFieldWidth((IGnosisContentControlImplementation)ControlImplementation, font, fontSize, MaxDisplayChars);
                }

                if (MinDisplayChars > 0)
                {
                    //MinFieldWidth = StyleManager.GetMinFieldWidth(MinDisplayChars);
                    MinFieldWidth = GlobalData.Singleton.StyleHelper.GetMinFieldWidth((IGnosisContentControlImplementation)ControlImplementation, font, fontSize, MinDisplayChars);
                }


                if (MinFieldWidth > MaxFieldWidth)
                {
                    MinFieldWidth = MaxFieldWidth;
                }
                else if (MaxFieldWidth < MinFieldWidth)
                {
                    MaxFieldWidth = MinFieldWidth;
                }

                //if (ControlImplementation is IGnosisCaptionLabelPossessor)
                //{
                //    GnosisCaptionLabel captionLabel = ((IGnosisCaptionLabelPossessor)ControlImplementation).CaptionLabel;
                //    if (captionLabel.RelativePosition == CaptionPosition.LEFT || captionLabel.RelativePosition == CaptionPosition.RIGHT)
                //    {
                //        double captionWidth = captionLabel.GetWidth() + (2 * captionLabel.HorizontalMargin);
                //        minFieldWidth += captionWidth;
                //        maxFieldWidth += captionWidth;
                //    }
                //}
            }

            //field height
            fieldHeight = GlobalData.Singleton.StyleHelper.GetFieldHeight((IGnosisContentControlImplementation)ControlImplementation, font, fontSize);

            ((IGnosisContentControlImplementation)ControlImplementation).SetHeight(fieldHeight);

            ((IGnosisContentControlImplementation)ControlImplementation).SetVerticalAlignment(VerticalAlignmentType.TOP);


            if (((IGnosisContentControlImplementation)ControlImplementation)._ContentHorizontalAlignment == HorizontalAlignmentType.NONE)
            {
                if (Dataset != null && DatasetItem != null)
                {
                    HorizontalAlignmentType ha = EntityController.GetContentHorizontalAlignment(Dataset, DatasetItem);
                    ((IGnosisContentControlImplementation)ControlImplementation)._ContentHorizontalAlignment = ha;
                }
            }
        }
示例#25
0
 public void CreateTextParagraph(string styleName, HorizontalAlignmentType alignment, string text)
 {
     var titleCreator = new ParagraphCreator();
     titleCreator.CreateTextParagraph(this._package, styleName, alignment, text, null);
 }