public void TestUpdateTableCellFormat()
        {
            var localName  = "TablesGet.docx";
            var remoteName = "TestUpdateTableCellFormat.docx";
            var fullName   = Path.Combine(this.dataFolder, remoteName);
            var cellFormat = new TableCellFormat {
                BottomPadding = 5, FitText = true, HorizontalMerge = TableCellFormat.HorizontalMergeEnum.First, WrapText = true
            };

            this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName));

            var request = new UpdateTableCellFormatRequest(remoteName, "sections/0/tables/2/rows/0", 0, this.dataFolder, format: cellFormat);
            var actual  = this.WordsApi.UpdateTableCellFormat(request);

            Assert.AreEqual(200, actual.Code);
        }
Exemplo n.º 2
0
        public static void UpdateTableCellFormat()
        {
            string          name         = "updateTableCellFormat.docx";
            string          tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
            int?            index        = 0;
            string          folder       = "input";
            string          storage      = null;
            TableCellFormat format       = new TableCellFormat
            {
                Width           = 1000,
                BackgroundColor = new Color(100, 100, 100)
            };
            string password     = null;
            string destFilePath = "output/UpdateTableCellFormat_output.docx";

            tablesApi.UpdateTableCellFormat(name, tableRowPath, index, format, destFilePath, folder, storage, password);
        }
Exemplo n.º 3
0
        private void InitializesStyles()
        {
            _title1 = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading1, _innerDocument);
            _title1.CharacterFormat.FontName  = "Segoe UI";
            _title1.CharacterFormat.FontColor = new Color(18, 97, 225);

            _title2 = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading2, _innerDocument);
            _title2.CharacterFormat.FontName  = "Segoe UI";
            _title2.CharacterFormat.FontColor = new Color(59, 59, 59);

            _innerDocument.Styles.Add(_title1);
            _innerDocument.Styles.Add(_title2);

            _cellHeader      = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Normal, _innerDocument);
            _cellHeader.Name = "MyHeaderCells";
            _cellHeader.CharacterFormat.Bold     = true;
            _cellHeader.CharacterFormat.FontName = "Segoe UI";
            _innerDocument.Styles.Add(_cellHeader);

            _cellContent      = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Normal, _innerDocument);
            _cellContent.Name = "MyContentCells";
            _cellContent.CharacterFormat.FontName = "Segoe UI";
            _innerDocument.Styles.Add(_cellContent);

            _tcfHeader = new TableCellFormat();
            _tcfHeader.Borders.SetBorders(MultipleBorderTypes.Bottom, BorderStyle.Single, new Color(165, 172, 181), 1);
            _tcfHeader.Borders.SetBorders(MultipleBorderTypes.Left | MultipleBorderTypes.Right, BorderStyle.None,
                                          Color.White, 0);
            _tcfHeader.BackgroundColor = new Color(245, 247, 249);

            _tcfContent = new TableCellFormat();
            _tcfContent.Borders.SetBorders(MultipleBorderTypes.All, BorderStyle.None, new Color(255, 255, 255), 0);

            _numberList = new ListStyle("NumberWithDot", ListTemplateType.NumberWithDot);

            _innerDocument.Styles.Add(_numberList);
        }
Exemplo n.º 4
0
        private void InitializesStyles()
        {
            _title1 = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading1, _innerDocument);
            _title1.CharacterFormat.FontName = "Segoe UI";
            _title1.CharacterFormat.FontColor = new Color(18, 97, 225);

            _title2 = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Heading2, _innerDocument);
            _title2.CharacterFormat.FontName = "Segoe UI";
            _title2.CharacterFormat.FontColor = new Color(59, 59, 59);

            _innerDocument.Styles.Add(_title1);
            _innerDocument.Styles.Add(_title2);

            _cellHeader = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Normal, _innerDocument);
            _cellHeader.Name = "MyHeaderCells";
            _cellHeader.CharacterFormat.Bold = true;
            _cellHeader.CharacterFormat.FontName = "Segoe UI";
            _innerDocument.Styles.Add(_cellHeader);

            _cellContent = (ParagraphStyle)Style.CreateStyle(StyleTemplateType.Normal, _innerDocument);
            _cellContent.Name = "MyContentCells";
            _cellContent.CharacterFormat.FontName = "Segoe UI";
            _innerDocument.Styles.Add(_cellContent);

            _tcfHeader = new TableCellFormat();
            _tcfHeader.Borders.SetBorders(MultipleBorderTypes.Bottom, BorderStyle.Single, new Color(165, 172, 181), 1);
            _tcfHeader.Borders.SetBorders(MultipleBorderTypes.Left | MultipleBorderTypes.Right, BorderStyle.None,
                                          Color.White, 0);
            _tcfHeader.BackgroundColor = new Color(245, 247, 249);

            _tcfContent = new TableCellFormat();
            _tcfContent.Borders.SetBorders(MultipleBorderTypes.All, BorderStyle.None, new Color(255, 255, 255), 0);

            _numberList = new ListStyle("NumberWithDot", ListTemplateType.NumberWithDot);

            _innerDocument.Styles.Add(_numberList);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateTableCellFormatOnlineRequest"/> class.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="tableRowPath">The path to the table row in the document tree.</param>
 /// <param name="format">The properties.</param>
 /// <param name="index">Object index.</param>
 /// <param name="loadEncoding">Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.</param>
 /// <param name="password">Password for opening an encrypted document.</param>
 /// <param name="destFileName">Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.</param>
 /// <param name="revisionAuthor">Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.</param>
 /// <param name="revisionDateTime">The date and time to use for revisions.</param>
 public UpdateTableCellFormatOnlineRequest(System.IO.Stream document, string tableRowPath, TableCellFormat format, int index, string loadEncoding = null, string password = null, string destFileName = null, string revisionAuthor = null, string revisionDateTime = null)
 {
     this.Document         = document;
     this.TableRowPath     = tableRowPath;
     this.Format           = format;
     this.Index            = index;
     this.LoadEncoding     = loadEncoding;
     this.Password         = password;
     this.DestFileName     = destFileName;
     this.RevisionAuthor   = revisionAuthor;
     this.RevisionDateTime = revisionDateTime;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateTableCellFormatRequest"/> class.
 /// </summary>
 /// <param name="name">The filename of the input document.</param>
 /// <param name="tableRowPath">The path to the table row in the document tree.</param>
 /// <param name="index">Object index.</param>
 /// <param name="format">The properties.</param>
 /// <param name="folder">Original document folder.</param>
 /// <param name="storage">Original document storage.</param>
 /// <param name="loadEncoding">Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.</param>
 /// <param name="password">Password for opening an encrypted document.</param>
 /// <param name="destFileName">Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.</param>
 /// <param name="revisionAuthor">Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.</param>
 /// <param name="revisionDateTime">The date and time to use for revisions.</param>
 public UpdateTableCellFormatRequest(string name, string tableRowPath, int index, TableCellFormat format, string folder = null, string storage = null, string loadEncoding = null, string password = null, string destFileName = null, string revisionAuthor = null, string revisionDateTime = null)
 {
     this.Name             = name;
     this.TableRowPath     = tableRowPath;
     this.Index            = index;
     this.Format           = format;
     this.Folder           = folder;
     this.Storage          = storage;
     this.LoadEncoding     = loadEncoding;
     this.Password         = password;
     this.DestFileName     = destFileName;
     this.RevisionAuthor   = revisionAuthor;
     this.RevisionDateTime = revisionDateTime;
 }