docx-wasm 0.4.10 → 0.4.12-beta0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { DocGridType } from ".";
2
2
  import { Footer } from "./footer";
3
3
  import { Header } from "./header";
4
+ import { PageNumType } from "./json/bindings/PageNumType";
4
5
  export declare type DocGrid = {
5
6
  gridType: DocGridType;
6
7
  linePitch?: number;
@@ -16,6 +17,7 @@ export declare class SectionProperty {
16
17
  _footer: Footer | null;
17
18
  _firstFooter: Footer | null;
18
19
  _evenFooter: Footer | null;
20
+ _pageTypeNum: PageNumType | null;
19
21
  pageSize(w: number, h: number): this;
20
22
  pageMargin(margin: Partial<PageMargin>): this;
21
23
  pageOrientation(orient: PageOrientationType): this;
@@ -26,6 +28,10 @@ export declare class SectionProperty {
26
28
  footer(footer: Footer): this;
27
29
  firstFooter(footer: Footer): this;
28
30
  evenFooter(footer: Footer): this;
31
+ pageTypeNum({ start, chapStyle }: {
32
+ start: number;
33
+ chapStyle: string;
34
+ }): this;
29
35
  }
30
36
  export declare type PageOrientationType = "landscape" | "portrait";
31
37
  export declare type PageSize = {
@@ -12,6 +12,7 @@ export class SectionProperty {
12
12
  this._footer = null;
13
13
  this._firstFooter = null;
14
14
  this._evenFooter = null;
15
+ this._pageTypeNum = null;
15
16
  }
16
17
  pageSize(w, h) {
17
18
  this._pageSize.w = w;
@@ -54,6 +55,10 @@ export class SectionProperty {
54
55
  this._evenFooter = footer;
55
56
  return this;
56
57
  }
58
+ pageTypeNum({ start, chapStyle }) {
59
+ this._pageTypeNum = { start, chapStyle };
60
+ return this;
61
+ }
57
62
  }
58
63
  export const defaultPageMargin = () => {
59
64
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"section-property.js","sourceRoot":"","sources":["../../js/section-property.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,eAAe;IAA5B;QACE,cAAS,GAAa;YACpB,CAAC,EAAE,KAAK;YAC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I,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,MAAc;QACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,MAAc;QACvB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAgBD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO;QACL,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,CAAC;KACV,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"section-property.js","sourceRoot":"","sources":["../../js/section-property.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,eAAe;IAA5B;QACE,cAAS,GAAa;YACpB,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;SACT,CAAC;QACF,gBAAW,GAAsB,IAAI,CAAC;QACtC,aAAQ,GAAmB,IAAI,CAAC;QAChC,YAAO,GAAkB,IAAI,CAAC;QAC9B,iBAAY,GAAkB,IAAI,CAAC;QACnC,gBAAW,GAAkB,IAAI,CAAC;QAClC,YAAO,GAAkB,IAAI,CAAC;QAC9B,iBAAY,GAAkB,IAAI,CAAC;QACnC,gBAAW,GAAkB,IAAI,CAAC;QAClC,iBAAY,GAAuB,IAAI,CAAC;IAyD1C,CAAC;IAvDC,QAAQ,CAAC,CAAS,EAAE,CAAS;QAC3B,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,MAA2B;QACpC,IAAI,CAA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IAAI;QACV,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,CAAC;KACV,CAAC;AACJ,CAAC,CAAC"}
package/js/index.ts CHANGED
@@ -517,6 +517,12 @@ export class Docx {
517
517
  }
518
518
  }
519
519
 
520
+ if (this.sectionProperty._pageTypeNum) {
521
+ const { start, chapStyle } = this.sectionProperty._pageTypeNum;
522
+ const p = wasm.createPageNumType(start, chapStyle);
523
+ docx = docx.page_num_type(p);
524
+ }
525
+
520
526
  if (this.sectionProperty._docGrid) {
521
527
  const { gridType, charSpace, linePitch } = this.sectionProperty._docGrid;
522
528
  let type = wasm.DocGridType.Default;
@@ -0,0 +1,2 @@
1
+
2
+ export interface PageNumType { start?: number, chapStyle?: string, }
@@ -1,5 +1,8 @@
1
1
  import { HeaderJSON, HeaderReferenceJSON } from "./header";
2
2
  import { FooterJSON, FooterReferenceJSON } from "./footer";
3
+ import { PageNumType as PageNumTypeJSON } from "./bindings/PageNumType";
4
+
5
+ export { PageNumType as PageNumTypeJSON } from "./bindings/PageNumType";
3
6
 
4
7
  export type DocGridType = "default" | "lines" | "linesAndChars" | "snapToChars";
5
8
 
@@ -48,4 +51,5 @@ export type SectionPropertyJSON = {
48
51
  firstFooter?: FooterJSON;
49
52
  evenFooterReference?: FooterReferenceJSON;
50
53
  evenFooter?: FooterJSON;
54
+ pageNumType?: PageNumTypeJSON;
51
55
  };
@@ -1,6 +1,7 @@
1
1
  import { DocGridType } from ".";
2
2
  import { Footer } from "./footer";
3
3
  import { Header } from "./header";
4
+ import { PageNumType } from "./json/bindings/PageNumType";
4
5
 
5
6
  export type DocGrid = {
6
7
  gridType: DocGridType;
@@ -21,6 +22,7 @@ export class SectionProperty {
21
22
  _footer: Footer | null = null;
22
23
  _firstFooter: Footer | null = null;
23
24
  _evenFooter: Footer | null = null;
25
+ _pageTypeNum: PageNumType | null = null;
24
26
 
25
27
  pageSize(w: number, h: number) {
26
28
  this._pageSize.w = w;
@@ -72,6 +74,11 @@ export class SectionProperty {
72
74
  this._evenFooter = footer;
73
75
  return this;
74
76
  }
77
+
78
+ pageTypeNum({ start, chapStyle }: { start: number; chapStyle: string }) {
79
+ this._pageTypeNum = { start, chapStyle };
80
+ return this;
81
+ }
75
82
  }
76
83
 
77
84
  export type PageOrientationType = "landscape" | "portrait";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docx-wasm",
3
- "version": "0.4.10",
3
+ "version": "0.4.12-beta0",
4
4
  "main": "dist/node/index.js",
5
5
  "browser": "dist/web/index.js",
6
6
  "author": "bokuweb <bokuweb12@gmail.com>",