public void TestPutFormField() { var localName = "test_multi_pages.docx"; var remoteName = "TestPutFormField.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var destFileName = Path.Combine(BaseTestOutPath, remoteName); var body = new FormFieldTextInput { Name = "FullName", Enabled = true, CalculateOnExit = true, StatusText = string.Empty, TextInputType = FormFieldTextInput.TextInputTypeEnum.Regular, TextInputDefault = "123", TextInputFormat = "UPPERCASE" }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PutFormFieldRequest(remoteName, body, this.dataFolder, nodePath: "sections/0/paragraphs/0", destFileName: destFileName); var actual = this.WordsApi.PutFormField(request); Assert.AreEqual(200, actual.Code); }
public void TestPostFormField() { var localName = "FormFilled.docx"; var remoteName = "TestPostFormField.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var formfieldIndex = 0; var destFileName = Path.Combine(BaseTestOutPath, remoteName); FormFieldTextInput body = new FormFieldTextInput { Name = "FullName", Enabled = true, CalculateOnExit = true, StatusText = string.Empty, TextInputType = FormFieldTextInput.TextInputTypeEnum.Regular, TextInputDefault = string.Empty }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.fieldFolder) + localName)); var request = new PostFormFieldRequest(remoteName, body, formfieldIndex, this.dataFolder, nodePath: "sections/0", destFileName: destFileName); FormFieldResponse actual = this.WordsApi.PostFormField(request); Assert.AreEqual(200, actual.Code); Assert.AreEqual("FullName", actual.FormField.Name); Assert.AreEqual(true, actual.FormField.Enabled); var formFieldTextInput = actual.FormField as FormFieldTextInput; Assert.IsTrue(formFieldTextInput != null, "Incorrect type of formfield: {0} instead of {1}", actual.FormField.GetType(), typeof(FormFieldTextInput)); Assert.AreEqual(FormFieldTextInput.TextInputTypeEnum.Regular, formFieldTextInput.TextInputType); }