Skip to content

Commit e292ea4

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 8fb830e + 3f61ca2 commit e292ea4

File tree

9 files changed

+195
-2
lines changed

9 files changed

+195
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/w
1616
- Add & remove watermarks and protection.
1717
- Read & write access to Document Object Model.
1818

19+
## Enhancements in Version 22.4
20+
21+
- Added ExportShapesAsSvg to HtmlSaveOption.
22+
- Added new endpoint '~/styles/copy_from'.
23+
24+
1925
## Enhancements in Version 22.3
2026

2127
- Online methods returns the dictionary of files with included original filename as key instead of single file content in responses.
2228
- Parameters contained sensitive data should be passed in encrypted form. Names of the parameters have 'encrypted' prefix.
2329
- Added Encrypt method to encrypt data on the API public key. Use it to prepare values for parameters required encrypted data.
2430
- GetPublicKey method is not billable.
31+
- Changed type of enumerations for members of SaveOptionsData and other inherited classes from string to enum.
2532

2633

2734
## Enhancements in Version 22.2
11.8 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asposewordscloud",
3-
"version": "22.3.0",
3+
"version": "22.4.0",
44
"description": "Aspose.Words Cloud SDK for Node.js",
55
"homepage": "https://products.aspose.cloud/words/cloud",
66
"author": {

src/api.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,24 @@ export class WordsApi implements Encryptor {
423423
return Promise.resolve(result);
424424
}
425425

426+
/**
427+
* Copies styles from the origin document to the target document.
428+
* @param requestObj contains request parameters
429+
*/
430+
public async copyStylesFromTemplate(requestObj: model.CopyStylesFromTemplateRequest): Promise< model.WordsIncomingMessage< model.WordsResponse > > {
431+
if (requestObj === null || requestObj === undefined) {
432+
throw new Error('Required parameter "request" was null or undefined when calling copyStylesFromTemplate.');
433+
}
434+
435+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
436+
437+
const response = await invokeApiMethod(requestOptions, this.configuration);
438+
const result = new model.WordsIncomingMessage< model.WordsResponse >();
439+
result.response = response;
440+
result.body = requestObj.createResponse(response.body, response.headers);
441+
return Promise.resolve(result);
442+
}
443+
426444
/**
427445
* Supported extensions: ".doc", ".docx", ".docm", ".dot", ".dotm", ".dotx", ".flatopc", ".fopc", ".flatopc_macro", ".fopc_macro", ".flatopc_template", ".fopc_template", ".flatopc_template_macro", ".fopc_template_macro", ".wordml", ".wml", ".rtf".
428446
* @param requestObj contains request parameters

src/internal/requestHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function invokeApiMethodInternal(requestOptions: request.OptionsWithUri, c
131131
requestOptions.timeout = 1000 * confguration.timeout;
132132

133133
requestOptions.headers["x-aspose-client"] = "nodejs sdk";
134-
requestOptions.headers["x-aspose-client-version"] = "22.3";
134+
requestOptions.headers["x-aspose-client-version"] = "22.4";
135135

136136
requestOptions.uri = encodeURI(requestOptions.uri.toString());
137137

src/model/htmlSaveOptionsData.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ export class HtmlSaveOptionsData extends SaveOptionsData {
140140
baseName: "ExportRoundtripInformation",
141141
type: "boolean",
142142
},
143+
{
144+
name: "exportShapesAsSvg",
145+
baseName: "ExportShapesAsSvg",
146+
type: "boolean",
147+
},
143148
{
144149
name: "exportTextBoxAsSvg",
145150
baseName: "ExportTextBoxAsSvg",
@@ -349,6 +354,11 @@ export class HtmlSaveOptionsData extends SaveOptionsData {
349354
*/
350355
public exportRoundtripInformation: boolean;
351356

357+
/**
358+
* Gets or sets the flag, that controls whether Aspose.Words.Drawing.Shape nodes are converted to SVG images when saving to HTML, MHTML or EPUB. Default value is false.
359+
*/
360+
public exportShapesAsSvg: boolean;
361+
352362
/**
353363
* Gets or sets the flag, that controls how textboxes represented by Aspose.Words.Drawing.Shape are saved to HTML, MHTML or EPUB. The default value is false.
354364
* When set to true, exports textboxes as inline "svg" elements. When false, exports as "image" elements.

src/model/model.ts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,6 +2911,125 @@ export class CopyStyleOnlineRequest implements RequestInterface {
29112911
}
29122912
}
29132913

2914+
/**
2915+
* Request model for CopyStylesFromTemplate operation.
2916+
* Copies styles from the origin document to the target document.
2917+
*/
2918+
export class CopyStylesFromTemplateRequest implements RequestInterface {
2919+
2920+
public constructor(init?: Partial< CopyStylesFromTemplateRequest >) {
2921+
Object.assign(this, init);
2922+
}
2923+
2924+
/**
2925+
* The filename of the target document.
2926+
*/
2927+
public name: string;
2928+
2929+
/**
2930+
* The filename of the origin document.
2931+
*/
2932+
public templateName: string;
2933+
2934+
/**
2935+
* Original document folder.
2936+
*/
2937+
public folder: string;
2938+
2939+
/**
2940+
* Original document storage.
2941+
*/
2942+
public storage: string;
2943+
2944+
/**
2945+
* Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
2946+
*/
2947+
public loadEncoding: string;
2948+
2949+
/**
2950+
* Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
2951+
*/
2952+
public password: string;
2953+
2954+
/**
2955+
* Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
2956+
*/
2957+
public encryptedPassword: string;
2958+
2959+
/**
2960+
* 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.
2961+
*/
2962+
public destFileName: string;
2963+
2964+
/**
2965+
* 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.
2966+
*/
2967+
public revisionAuthor: string;
2968+
2969+
/**
2970+
* The date and time to use for revisions.
2971+
*/
2972+
public revisionDateTime: string;
2973+
2974+
/**
2975+
* create the requst options for this request
2976+
* @param configuration a configuration for the request
2977+
* @param data encryptor
2978+
*/
2979+
public async createRequestOptions(configuration: Configuration, _encryptor: Encryptor) : Promise<request.OptionsWithUri> {
2980+
let localVarPath = configuration.getApiBaseUrl() + "/words/{name}/styles/copy_from"
2981+
.replace("/{" + "name" + "}", (this.name !== null && this.name !== undefined) ? "/" + String(this.name) : "")
2982+
.replace("//", "/");
2983+
const queryParameters: any = {};
2984+
// verify required parameter 'this.name' is not undefined
2985+
if (this.name === undefined) {
2986+
throw new Error('Required parameter "this.name" was undefined when calling copyStylesFromTemplate.');
2987+
}
2988+
2989+
// verify required parameter 'this.name' is not null
2990+
if (this.name === null) {
2991+
throw new Error('Required parameter "this.name" was null when calling copyStylesFromTemplate.');
2992+
}
2993+
2994+
// verify required parameter 'this.templateName' is not undefined
2995+
if (this.templateName === undefined) {
2996+
throw new Error('Required parameter "this.templateName" was undefined when calling copyStylesFromTemplate.');
2997+
}
2998+
2999+
// verify required parameter 'this.templateName' is not null
3000+
if (this.templateName === null) {
3001+
throw new Error('Required parameter "this.templateName" was null when calling copyStylesFromTemplate.');
3002+
}
3003+
3004+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "templateName", this.templateName, _encryptor);
3005+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "folder", this.folder, _encryptor);
3006+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "storage", this.storage, _encryptor);
3007+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "loadEncoding", this.loadEncoding, _encryptor);
3008+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "password", this.password, _encryptor);
3009+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "encryptedPassword", this.encryptedPassword, _encryptor);
3010+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "destFileName", this.destFileName, _encryptor);
3011+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionAuthor", this.revisionAuthor, _encryptor);
3012+
localVarPath = await addQueryParameterToUrl(localVarPath, queryParameters, "revisionDateTime", this.revisionDateTime, _encryptor);
3013+
3014+
const requestOptions: request.Options = {
3015+
method: "PUT",
3016+
qs: queryParameters,
3017+
uri: localVarPath,
3018+
json: true,
3019+
};
3020+
3021+
3022+
return Promise.resolve(requestOptions);
3023+
}
3024+
3025+
/**
3026+
* create response from string
3027+
*/
3028+
createResponse(_response: Buffer, _headers: http.IncomingHttpHeaders): any {
3029+
return ObjectSerializer.deserialize(_response, "WordsResponse");
3030+
}
3031+
}
3032+
29143033
/**
29153034
* Request model for CreateDocument operation.
29163035
* Supported extensions: ".doc", ".docx", ".docm", ".dot", ".dotm", ".dotx", ".flatopc", ".fopc", ".flatopc_macro", ".fopc_macro", ".flatopc_template", ".fopc_template", ".flatopc_template_macro", ".fopc_template_macro", ".wordml", ".wml", ".rtf".

src/model/pdfSaveOptionsData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ export namespace PdfSaveOptionsData {
332332
PdfA1b = 'PdfA1b' as any,
333333
PdfA2a = 'PdfA2a' as any,
334334
PdfA2u = 'PdfA2u' as any,
335+
PdfA4 = 'PdfA4' as any,
335336
PdfUa1 = 'PdfUa1' as any
336337
}
337338

test/styles/stylesTests.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,4 +421,42 @@ describe("styles", () => {
421421

422422
});
423423
});
424+
425+
// Test for copying styles from a template.
426+
describe("copyStylesFromTemplate test", () => {
427+
it("should return response with code 200", () => {
428+
const wordsApi = BaseTest.initializeWordsApi();
429+
const remoteFileName = "TestCopyStylesFromTemplate.docx";
430+
const templateFolder = "DocumentElements/Styles";
431+
const templateName = "StyleTemplate.docx";
432+
433+
return wordsApi.uploadFileToStorage(
434+
remoteDataFolder + "/" + remoteFileName,
435+
BaseTest.localBaseTestDataFolder + localFile
436+
).then((result0) => {
437+
expect(result0.response.statusMessage).to.equal("OK");
438+
return wordsApi.uploadFileToStorage(
439+
remoteDataFolder + "/" + templateName,
440+
BaseTest.localBaseTestDataFolder + templateFolder + "/" + templateName
441+
).then((result1) => {
442+
expect(result1.response.statusMessage).to.equal("OK");
443+
const request = new model.CopyStylesFromTemplateRequest({
444+
name: remoteFileName,
445+
templateName: templateName,
446+
folder: remoteDataFolder
447+
});
448+
449+
// Act
450+
return wordsApi.copyStylesFromTemplate(request)
451+
.then((resultApi) => {
452+
// Assert
453+
expect(resultApi.response.statusCode).to.equal(200);
454+
});
455+
456+
});
457+
458+
});
459+
460+
});
461+
});
424462
});

0 commit comments

Comments
 (0)