devexpress-richedit 24.1.1-alpha-24085-0102 → 24.1.2-beta
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.
- package/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +3 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.css +1 -0
- package/dist/dx.richedit.d.ts +17 -10
- package/dist/dx.richedit.js +52855 -51531
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/bars/ribbon.js +2 -1
- package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
- package/lib/client/client-rich-edit.js +2 -1
- package/lib/client/commands/client-command-manager.js +2 -1
- package/lib/client/commands/commands.js +3 -0
- package/lib/client/commands/download-document-command.d.ts +3 -0
- package/lib/client/commands/download-document-command.js +13 -2
- package/lib/client/commands/export-document-command.js +4 -4
- package/lib/client/commands/mail-merge-command.js +7 -4
- package/lib/client/commands/open-document-command.d.ts +2 -1
- package/lib/client/commands/open-document-command.js +17 -12
- package/lib/client/default-localization.js +2 -1
- package/lib/client/dialogs/finish-and-merge-dialog.js +1 -0
- package/lib/client/document-processor/processor.d.ts +9 -2
- package/lib/client/document-processor/processor.js +18 -6
- package/lib/client/formats/docx/export/data.d.ts +4 -0
- package/lib/client/formats/docx/export/data.js +12 -0
- package/lib/client/formats/docx/export/exporter.d.ts +2 -0
- package/lib/client/formats/docx/export/exporter.js +15 -0
- package/lib/client/formats/docx/export/exporters/base/sections.js +5 -0
- package/lib/client/formats/docx/export/exporters/note-properties.d.ts +18 -0
- package/lib/client/formats/docx/export/exporters/note-properties.js +83 -0
- package/lib/client/formats/docx/export/exporters/settings.d.ts +2 -0
- package/lib/client/formats/docx/export/exporters/settings.js +11 -0
- package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.d.ts +15 -1
- package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.js +85 -3
- package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.js +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.js +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.d.ts +37 -0
- package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.js +71 -0
- package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.d.ts +2 -2
- package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.js +2 -2
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.d.ts +16 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.js +48 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.js +9 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.js +39 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.d.ts +18 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.js +49 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.js +9 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.js +39 -0
- package/lib/client/formats/docx/import/destination/notes/note-destination.d.ts +18 -0
- package/lib/client/formats/docx/import/destination/notes/note-destination.js +45 -0
- package/lib/client/formats/docx/import/destination/notes/note-properties-destination.d.ts +32 -0
- package/lib/client/formats/docx/import/destination/notes/note-properties-destination.js +81 -0
- package/lib/client/formats/docx/import/destination/notes/note-reference-destination.d.ts +8 -0
- package/lib/client/formats/docx/import/destination/notes/note-reference-destination.js +21 -0
- package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.d.ts +5 -0
- package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.js +12 -0
- package/lib/client/formats/docx/import/destination/notes/note-separator-destination.d.ts +8 -0
- package/lib/client/formats/docx/import/destination/notes/note-separator-destination.js +20 -0
- package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-numbering-reference-destination.js +1 -1
- package/lib/client/formats/docx/import/destination/runs/run-destination.js +11 -5
- package/lib/client/formats/docx/import/destination/section/section-destination.js +5 -2
- package/lib/client/formats/docx/import/destination/settings/settings.js +4 -0
- package/lib/client/formats/docx/import/importer.d.ts +2 -0
- package/lib/client/formats/docx/import/importer.js +26 -0
- package/lib/client/formats/docx/import/importers/character-importer.d.ts +3 -0
- package/lib/client/formats/docx/import/importers/character-importer.js +12 -1
- package/lib/client/formats/docx/import/importers/end-notes-importer.d.ts +3 -4
- package/lib/client/formats/docx/import/importers/end-notes-importer.js +8 -3
- package/lib/client/formats/docx/import/importers/foot-notes-importer.d.ts +3 -5
- package/lib/client/formats/docx/import/importers/foot-notes-importer.js +8 -5
- package/lib/client/formats/docx/import/importers/notes-importer.d.ts +8 -0
- package/lib/client/formats/docx/import/importers/notes-importer.js +7 -0
- package/lib/client/formats/docx/translation-table/translation-tables.d.ts +7 -0
- package/lib/client/formats/docx/translation-table/translation-tables.js +27 -0
- package/lib/client/formats/docx/utils/constants.d.ts +2 -0
- package/lib/client/formats/docx/utils/constants.js +2 -0
- package/lib/client/model-api/formats/enum.d.ts +1 -0
- package/lib/client/model-api/formats/enum.js +1 -0
- package/lib/client/model-api/formats/exporter.d.ts +3 -4
- package/lib/client/model-api/formats/exporter.js +9 -6
- package/lib/client/model-api/formats/importer.js +2 -0
- package/lib/client/model-api/sub-document.d.ts +6 -2
- package/lib/client/model-api/sub-document.js +37 -35
- package/lib/client/model-api/table/table-borders.d.ts +1 -1
- package/lib/client/public/commands/enum.d.ts +1 -0
- package/lib/client/public/commands/enum.js +1 -0
- package/lib/client/public/document-processor.d.ts +3 -1
- package/lib/client/public/document-processor.js +2 -2
- package/lib/client/public/ribbon/item-ids.d.ts +1 -0
- package/lib/client/public/ribbon/item-ids.js +1 -0
- package/lib/client/public/rich-edit.d.ts +2 -1
- package/lib/client/public/rich-edit.js +16 -9
- package/lib/common/canvas/canvas-manager.js +2 -1
- package/lib/common/canvas/picture-renderer.d.ts +1 -1
- package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
- package/lib/common/canvas/renderes/common/document-renderer.js +6 -2
- package/lib/common/canvas/renderes/view-manager.js +3 -1
- package/lib/common/clipboard-content-inserter.js +2 -1
- package/lib/common/commands/client-command.d.ts +3 -1
- package/lib/common/commands/client-command.js +2 -0
- package/lib/common/commands/document/print-document-on-client-command.js +1 -1
- package/lib/common/commands/text/clipboard-commands.js +7 -5
- package/lib/common/document-format.d.ts +2 -0
- package/lib/common/document-format.js +2 -0
- package/lib/common/formats/document-importer-errors.d.ts +3 -1
- package/lib/common/formats/document-importer-errors.js +2 -0
- package/lib/common/formats/file-name-helper.d.ts +1 -0
- package/lib/common/formats/file-name-helper.js +7 -1
- package/lib/common/formats/html/export/get-html.d.ts +4 -0
- package/lib/common/formats/html/export/get-html.js +12 -0
- package/lib/common/formats/html/export/html-builder.d.ts +16 -0
- package/lib/common/formats/html/export/html-builder.js +98 -0
- package/lib/common/formats/html/export/html-document-exporter.d.ts +13 -0
- package/lib/common/formats/html/export/html-document-exporter.js +29 -0
- package/lib/common/formats/html/export/html-export.d.ts +25 -0
- package/lib/common/{html-export.js → formats/html/export/html-export.js} +115 -192
- package/lib/common/formats/html/import/html-document-importer.d.ts +15 -0
- package/lib/common/formats/html/import/html-document-importer.js +84 -0
- package/lib/common/formats/html/import/html-importer.d.ts +1 -0
- package/lib/common/formats/html/import/html-importer.js +13 -1
- package/lib/common/formats/html/import/insert-html.d.ts +4 -0
- package/lib/common/formats/html/import/insert-html.js +5 -0
- package/lib/common/formats/html/import/utils/paragraph-properties-utils.d.ts +1 -0
- package/lib/common/formats/html/import/utils/paragraph-properties-utils.js +17 -4
- package/lib/common/formats/i-document-exporter.d.ts +14 -0
- package/lib/common/formats/rtf/export/exporter.d.ts +1 -1
- package/lib/common/formats/rtf/export/exporter.js +1 -1
- package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -1
- package/lib/common/formats/rtf/importer-in-subdocument.js +1 -1
- package/lib/common/formats/txt/txt-exporter.js +2 -1
- package/lib/common/input-controller.d.ts +2 -1
- package/lib/common/input-controller.js +5 -2
- package/lib/common/interfaces/i-rich-edit-core.d.ts +2 -0
- package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.d.ts +2 -1
- package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.js +4 -3
- package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.d.ts +2 -1
- package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.js +5 -4
- package/lib/common/layout/main-structures/layout-page.d.ts +1 -0
- package/lib/common/layout/main-structures/layout-page.js +5 -2
- package/lib/common/layout-formatter/box/generator/box-infos-generator.d.ts +1 -0
- package/lib/common/layout-formatter/box/generator/box-infos-generator.js +12 -2
- package/lib/common/layout-formatter/floating/page-anchored-object-holder.d.ts +5 -3
- package/lib/common/layout-formatter/floating/page-anchored-object-holder.js +7 -4
- package/lib/common/layout-formatter/formatter/base-formatter.js +0 -1
- package/lib/common/layout-formatter/formatter/main-formatter.js +1 -0
- package/lib/common/layout-formatter/managers/formatter-manager.d.ts +6 -2
- package/lib/common/layout-formatter/managers/formatter-manager.js +3 -1
- package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.js +20 -4
- package/lib/common/measurer/measurer.js +2 -1
- package/lib/common/model/chunk.d.ts +1 -0
- package/lib/common/model/chunk.js +27 -2
- package/lib/common/model/document-model.d.ts +4 -0
- package/lib/common/model/document-model.js +4 -1
- package/lib/common/model/enums.d.ts +3 -1
- package/lib/common/model/enums.js +2 -0
- package/lib/common/model/footnotes/footnote.d.ts +46 -0
- package/lib/common/model/footnotes/footnote.js +100 -0
- package/lib/common/model/json/importers/sub-document/json-sub-document-importer.js +3 -3
- package/lib/common/model/json/importers/sub-document/run-importers.d.ts +6 -0
- package/lib/common/model/json/importers/sub-document/run-importers.js +9 -0
- package/lib/common/model/model-checks/position.d.ts +2 -1
- package/lib/common/model/model-checks/position.js +11 -2
- package/lib/common/model/numbering-lists/numbering-helper.d.ts +2 -1
- package/lib/common/model/numbering-lists/numbering-helper.js +3 -0
- package/lib/common/model/paragraph/paragraph-style.d.ts +1 -0
- package/lib/common/model/paragraph/paragraph-style.js +6 -2
- package/lib/common/model/properties-merger/paragraph-properties-merger.js +1 -1
- package/lib/common/model/runs/run-base.d.ts +1 -0
- package/lib/common/model/runs/simple-runs.d.ts +8 -2
- package/lib/common/model/runs/simple-runs.js +12 -6
- package/lib/common/model/section/section-properties.d.ts +3 -0
- package/lib/common/model/special-characters.d.ts +3 -0
- package/lib/common/model/special-characters.js +3 -0
- package/lib/common/model/sub-document-infos.d.ts +18 -0
- package/lib/common/model/sub-document-infos.js +39 -0
- package/lib/common/model/sub-document.d.ts +2 -0
- package/lib/common/model/sub-document.js +18 -16
- package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.d.ts +1 -0
- package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.js +21 -13
- package/lib/common/processor.d.ts +2 -0
- package/lib/common/rich-edit-core.d.ts +6 -2
- package/lib/common/rich-edit-core.js +20 -1
- package/lib/common/selection/selection-intervals-info.js +1 -1
- package/lib/common/utils/_license.d.ts +1 -0
- package/lib/common/utils/_license.js +2 -0
- package/lib/common/utils/size-utils.d.ts +3 -0
- package/lib/common/utils/size-utils.js +17 -4
- package/package.json +3 -3
- package/lib/common/html-export.d.ts +0 -32
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -5,6 +5,7 @@ import { ToolbarSubMenuItem } from '../ribbon/toolbar-items/toolbar-sub-menu-ite
|
|
5
5
|
import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
6
6
|
import { StringMapUtils } from '@devexpress/utils/lib/utils/map/string';
|
7
7
|
import { createInnerTab } from '../public/ribbon/creator';
|
8
|
+
import { SizeUtils } from '../../common/utils/size-utils';
|
8
9
|
export class ClientRibbonBar extends RibbonBarBase {
|
9
10
|
constructor(ownerControl, ownerElement, apiRibbon, fonts) {
|
10
11
|
var _a;
|
@@ -98,7 +99,7 @@ export class ClientRibbonBar extends RibbonBarBase {
|
|
98
99
|
}
|
99
100
|
getHeight() {
|
100
101
|
const elem = this.ribbon.getTabPanel().element();
|
101
|
-
return
|
102
|
+
return (elem[0] ? SizeUtils.getOffsetHeight(elem[0]) : SizeUtils.getOffsetHeight(elem));
|
102
103
|
}
|
103
104
|
setActiveTabIndex(index) {
|
104
105
|
this.ribbon.getTabPanel().option('selectedIndex', index);
|
@@ -34,7 +34,8 @@ export class RibbonItemsData {
|
|
34
34
|
items: [
|
35
35
|
{ text: formatMessage("ASPxRichEditStringId.Download_WordDocument"), name: Command.DownloadDocx },
|
36
36
|
{ text: formatMessage("ASPxRichEditStringId.Download_RichTextFormat"), name: Command.DownloadRtf },
|
37
|
-
{ text: formatMessage("ASPxRichEditStringId.Download_PlainText"), name: Command.DownloadTxt }
|
37
|
+
{ text: formatMessage("ASPxRichEditStringId.Download_PlainText"), name: Command.DownloadTxt },
|
38
|
+
{ text: formatMessage("ASPxRichEditStringId.Download_Html"), name: Command.DownloadHtml },
|
38
39
|
]
|
39
40
|
},
|
40
41
|
{ type: 'Button', text: getTrimmedMessage("OfficeStringId.MenuCmd_Print"), icon: 'dxre-icon-Print', alwaysShowText: true, name: Command.PrintDocumentOnClient }
|
@@ -31,6 +31,7 @@ import { ClientQuickSearchPanel } from './ui/client-quick-search-panel';
|
|
31
31
|
import { RulerVisibility } from '../common/ui/ruler/settings';
|
32
32
|
import { FullScreenHelper } from './ui/full-screen-helper';
|
33
33
|
import config from 'devextreme/core/config';
|
34
|
+
import { SizeUtils } from '../common/utils/size-utils';
|
34
35
|
export class ClientRichEdit {
|
35
36
|
constructor(element, options, publicRichEdit) {
|
36
37
|
var _a;
|
@@ -334,7 +335,7 @@ export class ClientRichEdit {
|
|
334
335
|
this.core.horizontalRulerControl.adjust();
|
335
336
|
const rulerHeight = this.core.horizontalRulerControl.getHeight();
|
336
337
|
this.core.viewManager.canvas.style.height = "0";
|
337
|
-
this.core.viewManager.canvas.style.height = this.element
|
338
|
+
this.core.viewManager.canvas.style.height = SizeUtils.getClientHeight(this.element) - rulerHeight - ribbonHeight + "px";
|
338
339
|
this.core.viewManager.adjust(true);
|
339
340
|
}
|
340
341
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { RichEditClientCommand } from '../../common/commands/client-command';
|
2
2
|
import { CommandManager } from '../../common/commands/command-manager';
|
3
|
-
import { DownloadDocumentCommand, DownloadDocxCommand, DownloadRtfCommand, DownloadTxtCommand } from './download-document-command';
|
3
|
+
import { DownloadDocumentCommand, DownloadDocxCommand, DownloadHtmlCommand, DownloadRtfCommand, DownloadTxtCommand, } from './download-document-command';
|
4
4
|
import { ExportDocumentCommand } from './export-document-command';
|
5
5
|
import { InsertPictureCommand } from './insert-picture-command';
|
6
6
|
import { MailMergeCommand } from './mail-merge-command';
|
@@ -17,6 +17,7 @@ export class ClientCommandManager extends CommandManager {
|
|
17
17
|
this.createCommand(control, RichEditClientCommand.DownloadDocx, DownloadDocxCommand);
|
18
18
|
this.createCommand(control, RichEditClientCommand.DownloadRtf, DownloadRtfCommand);
|
19
19
|
this.createCommand(control, RichEditClientCommand.DownloadTxt, DownloadTxtCommand);
|
20
|
+
this.createCommand(control, RichEditClientCommand.DownloadHtml, DownloadHtmlCommand);
|
20
21
|
this.createCommand(control, RichEditClientCommand.MailMergeOnClient, MailMergeCommand);
|
21
22
|
}
|
22
23
|
}
|
@@ -32,6 +32,9 @@ export function executeApiCommandCore(commandManager, commandId, parameter) {
|
|
32
32
|
case FileTabCommandId.DownloadTxt:
|
33
33
|
parameter = undefined;
|
34
34
|
break;
|
35
|
+
case FileTabCommandId.DownloadHtml:
|
36
|
+
parameter = undefined;
|
37
|
+
break;
|
35
38
|
case FileTabCommandId.PrintDocument:
|
36
39
|
parameter = undefined;
|
37
40
|
break;
|
@@ -19,6 +19,9 @@ export declare class DownloadRtfCommand extends DownloadDocumentCommand {
|
|
19
19
|
export declare class DownloadTxtCommand extends DownloadDocumentCommand {
|
20
20
|
executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<DownloadDocumentParameters>): boolean;
|
21
21
|
}
|
22
|
+
export declare class DownloadHtmlCommand extends DownloadDocumentCommand {
|
23
|
+
executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<DownloadDocumentParameters>): boolean;
|
24
|
+
}
|
22
25
|
export declare class DownloadDocumentParameters {
|
23
26
|
fileName: string;
|
24
27
|
documentFormat: DocumentFormat;
|
@@ -5,6 +5,7 @@ import { DocumentFormat } from '../../common/document-format';
|
|
5
5
|
import { FileNameHelper } from '../../common/formats/file-name-helper';
|
6
6
|
import { ControlOptions, DocumentCapability } from '../../common/model/options/control';
|
7
7
|
import { FileUtils } from '@devexpress/utils/lib/utils/file';
|
8
|
+
import { StringUtils } from '@devexpress/utils/lib/utils/string';
|
8
9
|
import { exportModelToBlob } from '../model-api/formats/exporter';
|
9
10
|
export class DownloadDocumentCommand extends CommandBase {
|
10
11
|
getState() {
|
@@ -27,8 +28,12 @@ export class DownloadDocumentCommand extends CommandBase {
|
|
27
28
|
return;
|
28
29
|
if (fileName === "")
|
29
30
|
fileName = DocumentInfo.defaultDocumentName;
|
30
|
-
const
|
31
|
-
|
31
|
+
const { documentExtension, documentFormat: currentDocumentFormat } = this.control.documentInfo;
|
32
|
+
const keepExtension = !StringUtils.isNullOrEmpty(documentExtension) && currentDocumentFormat === documentFormat;
|
33
|
+
const extension = keepExtension ? documentExtension : FileNameHelper.convertToString(documentFormat);
|
34
|
+
const finalFileName = fileName + extension;
|
35
|
+
const exportModelOptions = this.control.getExportModelOptions({ documentFormat });
|
36
|
+
exportModelToBlob(exportModelOptions, blob => FileUtils.startDownloadFileLocal(blob, finalFileName));
|
32
37
|
core.fileDownloaded = true;
|
33
38
|
setTimeout(() => {
|
34
39
|
core.fileDownloaded = false;
|
@@ -62,6 +67,12 @@ export class DownloadTxtCommand extends DownloadDocumentCommand {
|
|
62
67
|
return true;
|
63
68
|
}
|
64
69
|
}
|
70
|
+
export class DownloadHtmlCommand extends DownloadDocumentCommand {
|
71
|
+
executeCore(_state, options) {
|
72
|
+
this.download(this.getFileName(options), DocumentFormat.Html);
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
}
|
65
76
|
export class DownloadDocumentParameters {
|
66
77
|
constructor(documentFormat, fileName = "") {
|
67
78
|
this.documentFormat = documentFormat;
|
@@ -2,6 +2,7 @@ import { CommandBase } from '../../common/commands/command-base';
|
|
2
2
|
import { SimpleCommandState } from '../../common/commands/command-states';
|
3
3
|
import { ControlOptions, DocumentCapability } from '../../common/model/options/control';
|
4
4
|
import { exportModelToBase64 } from '../model-api/formats/exporter';
|
5
|
+
import { isDefined } from '@devexpress/utils/lib/utils/common';
|
5
6
|
export class ExportDocumentCommandOptions {
|
6
7
|
constructor(documentFormat, reason, documentName) {
|
7
8
|
this.documentFormat = documentFormat;
|
@@ -22,11 +23,10 @@ export class ExportDocumentCommand extends CommandBase {
|
|
22
23
|
const richedit = this.control.owner;
|
23
24
|
const param = options.param;
|
24
25
|
const format = this.getExportDocumentFormat(richedit.core, param);
|
25
|
-
const fileName = param.documentName
|
26
|
-
param.documentName :
|
27
|
-
this.control.documentInfo.getFileNameForDownload();
|
26
|
+
const fileName = isDefined(param.documentName) ? param.documentName : this.control.documentInfo.getFileNameForDownload();
|
28
27
|
const reason = param.reason ? param.reason : '';
|
29
|
-
|
28
|
+
const exportModelOptions = this.control.getExportModelOptions({ documentFormat: format });
|
29
|
+
exportModelToBase64(exportModelOptions, base64 => this.exportCore(richedit, base64, fileName, format, reason));
|
30
30
|
return true;
|
31
31
|
}
|
32
32
|
getExportDocumentFormat(core, param) {
|
@@ -45,7 +45,10 @@ export class MailMergeCommand extends CommandBase {
|
|
45
45
|
docxExporter.exportToBlob((blob) => {
|
46
46
|
const docxImporter = new Importer(new ImporterOptions());
|
47
47
|
docxImporter.importFromFile(blob, this.control.modelManager.richOptions, (documentModel, formatImagesImporter) => {
|
48
|
-
const
|
48
|
+
const exportModelOptions = this.control.getExportModelOptions({
|
49
|
+
documentFormat: options.param.documentFormat,
|
50
|
+
modelManager: this.createModelManager(documentModel),
|
51
|
+
});
|
49
52
|
this.control.commandManager.formatImagesImporters.push(formatImagesImporter);
|
50
53
|
formatImagesImporter.whenAllPicturesLoaded((successLoadedAllPictures) => {
|
51
54
|
const index = this.control.commandManager.formatImagesImporters.indexOf(formatImagesImporter);
|
@@ -54,10 +57,10 @@ export class MailMergeCommand extends CommandBase {
|
|
54
57
|
if (!successLoadedAllPictures)
|
55
58
|
throw new Error(Errors.InternalException);
|
56
59
|
const param = options.param;
|
57
|
-
this.prepareMergedDocument(modelManager, param);
|
58
|
-
exportModelToBlob(
|
60
|
+
this.prepareMergedDocument(exportModelOptions.modelManager, param);
|
61
|
+
exportModelToBlob(exportModelOptions, blob => param.callback(blob));
|
59
62
|
}, 3000);
|
60
|
-
formatImagesImporter.import(modelManager.modelManipulator);
|
63
|
+
formatImagesImporter.import(exportModelOptions.modelManager.modelManipulator);
|
61
64
|
}, () => { });
|
62
65
|
});
|
63
66
|
return true;
|
@@ -15,7 +15,8 @@ export declare class OpenDocumentCommand extends CommandBase<SimpleCommandState>
|
|
15
15
|
isEnabledInReadOnlyMode(): boolean;
|
16
16
|
private static getFileAndDocumentFormat;
|
17
17
|
private static getDocumentFormatByFileName;
|
18
|
-
static
|
18
|
+
private static getDocumentExtensionByFileName;
|
19
|
+
static getFileNameWithoutExtension(fileName: string): string;
|
19
20
|
}
|
20
21
|
export declare type ImportDocumentCallback = (importSuccess: boolean, importFailReason: string | null) => void;
|
21
22
|
export declare class FileInfo {
|
@@ -38,28 +38,30 @@ export class OpenDocumentCommand extends CommandBase {
|
|
38
38
|
const fileInfo = options.param;
|
39
39
|
if (fileInfo) {
|
40
40
|
const { file, documentFormat } = OpenDocumentCommand.getFileAndDocumentFormat(fileInfo);
|
41
|
-
const
|
42
|
-
|
41
|
+
const extension = OpenDocumentCommand.getDocumentExtensionByFileName(file.name);
|
42
|
+
const fileName = OpenDocumentCommand.getFileNameWithoutExtension(fileInfo.fileName);
|
43
|
+
return this.executeOpening(file, fileName, documentFormat, extension, fileInfo.callback);
|
43
44
|
}
|
44
45
|
else {
|
45
46
|
const input = document.createElement('input');
|
46
47
|
input.type = 'file';
|
47
48
|
input.accept = Browser.AndroidMobilePlatform ?
|
48
49
|
'text/plain,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12' :
|
49
|
-
'.txt,.docx,.rtf,.docm';
|
50
|
+
'.txt,.docx,.rtf,.docm,.html,.htm';
|
50
51
|
input.addEventListener('change', (e) => {
|
51
52
|
const file = e.target.files[0];
|
52
53
|
if (file) {
|
53
54
|
const format = OpenDocumentCommand.getDocumentFormatByFileName(file.name);
|
54
|
-
const
|
55
|
-
|
55
|
+
const extension = OpenDocumentCommand.getDocumentExtensionByFileName(file.name);
|
56
|
+
const fileName = OpenDocumentCommand.getFileNameWithoutExtension(file.name);
|
57
|
+
this.executeOpening(file, fileName, format, extension, null);
|
56
58
|
}
|
57
59
|
}, false);
|
58
60
|
input.click();
|
59
61
|
}
|
60
62
|
return true;
|
61
63
|
}
|
62
|
-
executeOpening(file, fileName, format, callback) {
|
64
|
+
executeOpening(file, fileName, format, extension, callback) {
|
63
65
|
const core = this.control;
|
64
66
|
const throwInvalidFile = reason => {
|
65
67
|
throw new Error(Errors.InternalException + " " + reason);
|
@@ -70,7 +72,7 @@ export class OpenDocumentCommand extends CommandBase {
|
|
70
72
|
this.beforeOpen();
|
71
73
|
core.activeDocumentImporter.importFromFile(file, this.control.modelManager.richOptions, (documentModel, formatImagesImporter) => {
|
72
74
|
core.activeDocumentImporter = null;
|
73
|
-
this.openCore(fileName, format, documentModel, formatImagesImporter);
|
75
|
+
this.openCore(fileName, format, documentModel, formatImagesImporter, extension);
|
74
76
|
if (!this.suppressUpdateFields)
|
75
77
|
this.updateSomeFields();
|
76
78
|
if (callback)
|
@@ -110,10 +112,10 @@ export class OpenDocumentCommand extends CommandBase {
|
|
110
112
|
this.control.closeDocument();
|
111
113
|
this.control.loadingPanelManager.loadingPanel.setVisible(true);
|
112
114
|
}
|
113
|
-
openCore(fileName, documentFormat, documentModel, formatImagesImporter) {
|
115
|
+
openCore(fileName, documentFormat, documentModel, formatImagesImporter, documentExtension) {
|
114
116
|
new ChunkSizeCorrector().correctChunkSizeAtChunkIndex(documentModel.mainSubDocument, 0);
|
115
117
|
new FontCorrector(this.control.modelManager.modelManipulator, documentModel, this.control.modelManager.richOptions.fonts).correct();
|
116
|
-
const documentInfo = new DocumentInfo(fileName, true, documentFormat);
|
118
|
+
const documentInfo = new DocumentInfo(fileName, true, documentFormat, documentExtension);
|
117
119
|
this.control.initialize('', documentInfo, NumberMapUtils.mapLength(documentModel.subDocuments), documentModel);
|
118
120
|
updateFieldSequenceInfo(this.control.modelManager, this.control.layoutFormatterManager, this.control.createFieldRequestManager());
|
119
121
|
formatImagesImporter.import(this.control.modelManager.modelManipulator);
|
@@ -203,9 +205,12 @@ export class OpenDocumentCommand extends CommandBase {
|
|
203
205
|
const docFormatByFileName = FileNameHelper.convertToDocumentFormat(fileName);
|
204
206
|
return docFormatByFileName === DocumentFormat.Undefined ? DocumentFormat.OpenXml : docFormatByFileName;
|
205
207
|
}
|
206
|
-
static
|
207
|
-
|
208
|
-
|
208
|
+
static getDocumentExtensionByFileName(fileName) {
|
209
|
+
return FileNameHelper.convertToDocumentExtension(fileName);
|
210
|
+
}
|
211
|
+
static getFileNameWithoutExtension(fileName) {
|
212
|
+
const extension = OpenDocumentCommand.getDocumentExtensionByFileName(fileName);
|
213
|
+
return !!extension && StringUtils.endsAt(fileName, extension) ? fileName.slice(0, -extension.length) : fileName;
|
209
214
|
}
|
210
215
|
}
|
211
216
|
export class FileInfo {
|
@@ -2217,7 +2217,8 @@ export function loadDefaultMessages() {
|
|
2217
2217
|
"RichEditExtensionsStringId.Caption_PageView": "View",
|
2218
2218
|
"ASPxRichEditStringId.Download_WordDocument": "Word Document (*.docx)",
|
2219
2219
|
"ASPxRichEditStringId.Download_RichTextFormat": "Rich Text Format (*.rtf)",
|
2220
|
-
"ASPxRichEditStringId.Download_PlainText": "Plain Text (*.txt)"
|
2220
|
+
"ASPxRichEditStringId.Download_PlainText": "Plain Text (*.txt)",
|
2221
|
+
"ASPxRichEditStringId.Download_Html": "Html Document (*.html, *.htm)",
|
2221
2222
|
}
|
2222
2223
|
});
|
2223
2224
|
}
|
@@ -84,6 +84,7 @@ export class FinishAndMergeDialog extends DialogBase {
|
|
84
84
|
{ text: 'Word Document (*.docx)', value: DocumentFormat.OpenXml },
|
85
85
|
{ text: 'Rich Text Format (*.rtf)', value: DocumentFormat.Rtf },
|
86
86
|
{ text: 'Plain Text (*.txt)', value: DocumentFormat.PlainText },
|
87
|
+
{ text: 'Html Document (*.html, *.htm)', value: DocumentFormat.Html },
|
87
88
|
],
|
88
89
|
valueExpr: 'value',
|
89
90
|
displayExpr: 'text',
|
@@ -7,16 +7,23 @@ import { FieldRequestManager } from '../../common/model/fields/field-request-man
|
|
7
7
|
import { RichOptions } from '../../common/model/options/rich-options';
|
8
8
|
import { IProcessor } from '../../common/processor';
|
9
9
|
import { ISelectionBase } from '../../common/selection/selection-base';
|
10
|
+
import { IExportModelOptions } from '../../common/formats/i-document-exporter';
|
10
11
|
import { CalculateDocumentVariableEventArgs } from './docvar-args';
|
12
|
+
import { IRichEditUnitConverter } from '../../common/utils/unit-converter';
|
13
|
+
import { DocumentRenderer } from '../../common/canvas/renderes/common/document-renderer';
|
11
14
|
export declare abstract class DocumentProcessorBase implements IProcessor {
|
12
15
|
readonly selection: ISelectionBase;
|
13
16
|
modelManager: IModelManager;
|
17
|
+
private documentRenderer;
|
18
|
+
private uiUnitConverter;
|
19
|
+
private sessionGuid;
|
20
|
+
private clientGuid;
|
14
21
|
layoutFormatterManager: FormatterManager;
|
15
22
|
onCalculateDocumentVariable: null | ((e: CalculateDocumentVariableEventArgs) => void);
|
16
23
|
private readonly innerClientProperties;
|
17
24
|
private readonly measurer;
|
18
25
|
private activeDocumentImporter;
|
19
|
-
constructor(richOptions: RichOptions);
|
26
|
+
constructor(richOptions: RichOptions, documentRenderer: DocumentRenderer, uiUnitConverter: IRichEditUnitConverter, sessionGuid: string, clientGuid: string);
|
20
27
|
abstract createFieldRequestManager(): FieldRequestManager;
|
21
28
|
protected abstract createModelManager(model: DocumentModel, richOptions: RichOptions): IModelManager;
|
22
29
|
dispose(): void;
|
@@ -26,9 +33,9 @@ export declare abstract class DocumentProcessorBase implements IProcessor {
|
|
26
33
|
exportDocumentToBlob(callback: (blob: Blob) => void, documentFormat?: DocumentFormat): void;
|
27
34
|
protected openDocumentInner(file: File, format: DocumentFormat, callback: (importSuccess: boolean) => void): void;
|
28
35
|
protected importImages(formatImagesImporter: FormatImagesImporter): void;
|
29
|
-
protected exportFormat(documentFormat?: DocumentFormat): DocumentFormat;
|
30
36
|
protected createModel(model: DocumentModel): void;
|
31
37
|
beginUpdate(): void;
|
32
38
|
endUpdate(): void;
|
33
39
|
invalidateLayoutAfterFontsLoaded(): void;
|
40
|
+
getExportModelOptions(initOptions?: Partial<IExportModelOptions>): IExportModelOptions;
|
34
41
|
}
|
@@ -9,13 +9,18 @@ import { ViewSettings } from '../../common/view-settings/views-settings';
|
|
9
9
|
import { Base64Utils } from '@devexpress/utils/lib/utils/base64';
|
10
10
|
import { exportModelToBase64, exportModelToBlob } from '../model-api/formats/exporter';
|
11
11
|
import { createImporter } from '../model-api/formats/importer';
|
12
|
+
import { isDefined } from '@devexpress/utils/lib/utils/common';
|
12
13
|
export class DocumentProcessorBase {
|
13
|
-
constructor(richOptions) {
|
14
|
+
constructor(richOptions, documentRenderer, uiUnitConverter, sessionGuid, clientGuid) {
|
14
15
|
this.selection = new SelectionBase();
|
15
16
|
this.onCalculateDocumentVariable = null;
|
16
17
|
this.measurer = new Measurer('');
|
17
18
|
this.modelManager = this.createModelManager(null, richOptions);
|
18
19
|
this.innerClientProperties = new InnerClientProperties(new ViewSettings());
|
20
|
+
this.documentRenderer = documentRenderer;
|
21
|
+
this.uiUnitConverter = uiUnitConverter;
|
22
|
+
this.sessionGuid = sessionGuid;
|
23
|
+
this.clientGuid = clientGuid;
|
19
24
|
}
|
20
25
|
dispose() {
|
21
26
|
this.measurer.dispose();
|
@@ -30,10 +35,10 @@ export class DocumentProcessorBase {
|
|
30
35
|
this.createModel(model);
|
31
36
|
}
|
32
37
|
exportDocumentToBase64(callback, documentFormat) {
|
33
|
-
exportModelToBase64(this.
|
38
|
+
exportModelToBase64(this.getExportModelOptions({ documentFormat }), callback);
|
34
39
|
}
|
35
40
|
exportDocumentToBlob(callback, documentFormat) {
|
36
|
-
exportModelToBlob(this.
|
41
|
+
exportModelToBlob(this.getExportModelOptions({ documentFormat }), callback);
|
37
42
|
}
|
38
43
|
openDocumentInner(file, format, callback) {
|
39
44
|
if (this.activeDocumentImporter) {
|
@@ -58,9 +63,6 @@ export class DocumentProcessorBase {
|
|
58
63
|
importImages(formatImagesImporter) {
|
59
64
|
formatImagesImporter.import(this.modelManager.modelManipulator);
|
60
65
|
}
|
61
|
-
exportFormat(documentFormat) {
|
62
|
-
return documentFormat === undefined || documentFormat === null ? DocumentFormat.OpenXml : documentFormat;
|
63
|
-
}
|
64
66
|
createModel(model) {
|
65
67
|
this.modelManager = this.createModelManager(model, this.modelManager.richOptions);
|
66
68
|
const layout = new DocumentLayout(new AnchorObjectsPositionInfo(model));
|
@@ -80,4 +82,14 @@ export class DocumentProcessorBase {
|
|
80
82
|
this.layoutFormatterManager.invalidator.onChangedAllLayout();
|
81
83
|
}
|
82
84
|
}
|
85
|
+
getExportModelOptions(initOptions = {}) {
|
86
|
+
return {
|
87
|
+
modelManager: isDefined(initOptions.modelManager) ? initOptions.modelManager : this.modelManager,
|
88
|
+
pictureRenderer: this.documentRenderer,
|
89
|
+
uiUnitConverter: this.uiUnitConverter,
|
90
|
+
sessionGuid: this.sessionGuid,
|
91
|
+
clientGuid: this.clientGuid,
|
92
|
+
documentFormat: isDefined(initOptions.documentFormat) ? initOptions.documentFormat : DocumentFormat.OpenXml,
|
93
|
+
};
|
94
|
+
}
|
83
95
|
}
|
@@ -54,6 +54,8 @@ export declare class Data {
|
|
54
54
|
contentTypesExporter: ContentTypesExporter;
|
55
55
|
subDocumentExporterStack: Stack<BaseSubDocumentExporter>;
|
56
56
|
exportedImageTable: Record<number, boolean>;
|
57
|
+
footNotes: Map<SubDocument, number>;
|
58
|
+
endNotes: Map<SubDocument, number>;
|
57
59
|
private writerStack;
|
58
60
|
private relationExporters;
|
59
61
|
constructor(model: DocumentModel, options: DocxExportOptions);
|
@@ -62,4 +64,6 @@ export declare class Data {
|
|
62
64
|
popRelationExporter(): void;
|
63
65
|
createTextBoxExporter(subDoc: SubDocument): TextBoxSubDocumentExporter;
|
64
66
|
init(): void;
|
67
|
+
addFootNote(note: SubDocument): number;
|
68
|
+
addEndNote(note: SubDocument): number;
|
65
69
|
}
|
@@ -44,6 +44,8 @@ export class Data {
|
|
44
44
|
this.styleExporter = new StylesExporter(this);
|
45
45
|
this.contentTypesExporter = new ContentTypesExporter(this);
|
46
46
|
this.exportedImageTable = {};
|
47
|
+
this.footNotes = new Map();
|
48
|
+
this.endNotes = new Map();
|
47
49
|
}
|
48
50
|
get writer() { return this.writerStack.last; }
|
49
51
|
set writer(val) { this.writerStack.push(val); }
|
@@ -60,4 +62,14 @@ export class Data {
|
|
60
62
|
this.headerCounter = 0;
|
61
63
|
this.footerCounter = 0;
|
62
64
|
}
|
65
|
+
addFootNote(note) {
|
66
|
+
const id = this.footNotes.size - 1;
|
67
|
+
this.footNotes.set(note, id);
|
68
|
+
return id;
|
69
|
+
}
|
70
|
+
addEndNote(note) {
|
71
|
+
const id = this.endNotes.size - 1;
|
72
|
+
this.endNotes.set(note, id);
|
73
|
+
return id;
|
74
|
+
}
|
63
75
|
}
|
@@ -9,6 +9,8 @@ export declare class DocxExporter implements IDocumentExporter {
|
|
9
9
|
exportToBlob(callback: (blob: Blob) => void): void;
|
10
10
|
exportToBase64(callback: (base64: string) => void): void;
|
11
11
|
private exportInner;
|
12
|
+
private addFootNoteSeparators;
|
13
|
+
private addEndNoteSeparators;
|
12
14
|
private exportCustomProperties;
|
13
15
|
private exportFootNotesAndEndNotes;
|
14
16
|
private exportComments;
|
@@ -7,6 +7,7 @@ import { StylesExporter } from './exporters/styles';
|
|
7
7
|
import { HeaderFooterSubDocumentExporter } from './exporters/sub-document/header-footer-sub-document-exporter';
|
8
8
|
import { MainSubDocumentExporter } from './exporters/sub-document/main-sub-document';
|
9
9
|
import { ThemeExporter } from './exporters/theme';
|
10
|
+
import { EndNoteExporter, FootNoteExporter } from './exporters/sub-document/note-sub-document-exporter';
|
10
11
|
export class DocxExporter {
|
11
12
|
constructor(modelManipulator, options) {
|
12
13
|
this.modelManipulator = modelManipulator;
|
@@ -26,6 +27,8 @@ export class DocxExporter {
|
|
26
27
|
});
|
27
28
|
}
|
28
29
|
exportInner() {
|
30
|
+
this.addFootNoteSeparators();
|
31
|
+
this.addEndNoteSeparators();
|
29
32
|
new CorePropertiesExporter(this.data).export();
|
30
33
|
this.exportCustomProperties();
|
31
34
|
new MainSubDocumentExporter(this.data, this.data.model.mainSubDocument, 'word/document.xml').export();
|
@@ -44,9 +47,21 @@ export class DocxExporter {
|
|
44
47
|
this.data.popRelationExporter();
|
45
48
|
this.data.contentTypesExporter.export();
|
46
49
|
}
|
50
|
+
addFootNoteSeparators() {
|
51
|
+
for (const separator of this.data.model.footNoteSeparators.getSeparatos())
|
52
|
+
this.data.addFootNote(separator);
|
53
|
+
}
|
54
|
+
addEndNoteSeparators() {
|
55
|
+
for (const separator of this.data.model.endNoteSeparators.getSeparatos())
|
56
|
+
this.data.addEndNote(separator);
|
57
|
+
}
|
47
58
|
exportCustomProperties() {
|
48
59
|
}
|
49
60
|
exportFootNotesAndEndNotes() {
|
61
|
+
if (this.data.footNotes.size > 0)
|
62
|
+
new FootNoteExporter(this.data).export();
|
63
|
+
if (this.data.endNotes.size > 0)
|
64
|
+
new EndNoteExporter(this.data).export();
|
50
65
|
}
|
51
66
|
exportComments() {
|
52
67
|
}
|
@@ -7,6 +7,7 @@ import { ContentType, DocxNsType } from '../../../utils/constants';
|
|
7
7
|
import { WriterHelper } from '../../utils/writer-helper';
|
8
8
|
import { BaseExporter } from '../base';
|
9
9
|
import { LineNumberDefaults } from '../../../../../../common/model/section/line-numbering-properties';
|
10
|
+
import { NotePropertiesExporter } from '../note-properties';
|
10
11
|
export class SectionExporter extends BaseExporter {
|
11
12
|
constructor(data, _section) {
|
12
13
|
super(data);
|
@@ -60,6 +61,9 @@ export class SectionExporter extends BaseExporter {
|
|
60
61
|
this.exportHeaderFooter(section.footers, HeaderFooterType.Odd);
|
61
62
|
}
|
62
63
|
exportSectionPropertiesCore(section) {
|
64
|
+
const noteExporter = new NotePropertiesExporter(this.data);
|
65
|
+
noteExporter.exportSectionLevelFootNoteProperties(section.sectionProperties.footNote);
|
66
|
+
noteExporter.exportSectionLevelEndNoteProperties(section.sectionProperties.endNote);
|
63
67
|
const props = section.sectionProperties;
|
64
68
|
this.writer.writeWpStringValue('type', WriterHelper.getValueFromTables(TranslationTables.sectionStartTypeTable, props.startType, SectionStartType.NextPage));
|
65
69
|
this.exportSectionPage(props);
|
@@ -67,6 +71,7 @@ export class SectionExporter extends BaseExporter {
|
|
67
71
|
this.exportSectionLineNumbering(props);
|
68
72
|
this.exportSectionPageNumbering(props);
|
69
73
|
this.exportSectionColumns(props);
|
74
|
+
noteExporter.exportSectionFootNoteColumnCount(section.sectionProperties.footNote);
|
70
75
|
this.exportSectionGeneralSettings(props);
|
71
76
|
}
|
72
77
|
exportSectionPage(props) {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { NoteProperties } from "../../../../../common/model/footnotes/footnote";
|
2
|
+
import { BaseExporter } from "./base";
|
3
|
+
export declare class NotePropertiesExporter extends BaseExporter {
|
4
|
+
private static readonly defaultProperties;
|
5
|
+
exportSectionLevelFootNoteProperties(properties: NoteProperties): void;
|
6
|
+
exportSectionLevelEndNoteProperties(properties: NoteProperties): void;
|
7
|
+
exportDocumentLevelFootNoteProperties(properties: NoteProperties): void;
|
8
|
+
exportDocumentLevelEndNoteProperties(properties: NoteProperties): void;
|
9
|
+
exportSectionFootNoteColumnCount(properties: NoteProperties): void;
|
10
|
+
private isDefault;
|
11
|
+
private exportNoteProperties;
|
12
|
+
private exportFootNoteSeparators;
|
13
|
+
private exportEndNoteSeparators;
|
14
|
+
private exportFootNoteSeparator;
|
15
|
+
private exportEndNoteSeparator;
|
16
|
+
private exportNoteSeparators;
|
17
|
+
private exportNoteSeparator;
|
18
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { NoteProperties } from "../../../../../common/model/footnotes/footnote";
|
2
|
+
import { TranslationTables } from "../../translation-table/translation-tables";
|
3
|
+
import { WriterHelper } from "../utils/writer-helper";
|
4
|
+
import { BaseExporter } from "./base";
|
5
|
+
import { DocxNsType } from "../../utils/constants";
|
6
|
+
export class NotePropertiesExporter extends BaseExporter {
|
7
|
+
exportSectionLevelFootNoteProperties(properties) {
|
8
|
+
if (!this.isDefault(properties)) {
|
9
|
+
this.writer.writeWpStartElement('footnotePr');
|
10
|
+
this.exportNoteProperties(properties);
|
11
|
+
this.writer.endElement();
|
12
|
+
}
|
13
|
+
}
|
14
|
+
exportSectionLevelEndNoteProperties(properties) {
|
15
|
+
if (!this.isDefault(properties)) {
|
16
|
+
this.writer.writeWpStartElement('endnotePr');
|
17
|
+
this.exportNoteProperties(properties);
|
18
|
+
this.writer.endElement();
|
19
|
+
}
|
20
|
+
}
|
21
|
+
exportDocumentLevelFootNoteProperties(properties) {
|
22
|
+
if (!this.isDefault(properties) || this.data.footNotes.size > 0) {
|
23
|
+
this.writer.writeWpStartElement('footnotePr');
|
24
|
+
this.exportNoteProperties(properties);
|
25
|
+
this.exportFootNoteSeparators();
|
26
|
+
this.writer.endElement();
|
27
|
+
}
|
28
|
+
}
|
29
|
+
exportDocumentLevelEndNoteProperties(properties) {
|
30
|
+
if (!this.isDefault(properties) || this.data.endNotes.size > 0) {
|
31
|
+
this.writer.writeWpStartElement('endnotePr');
|
32
|
+
this.exportNoteProperties(properties);
|
33
|
+
this.exportEndNoteSeparators();
|
34
|
+
this.writer.endElement();
|
35
|
+
}
|
36
|
+
}
|
37
|
+
exportSectionFootNoteColumnCount(properties) {
|
38
|
+
if (properties && properties.columnCount !== NotePropertiesExporter.defaultProperties.columnCount) {
|
39
|
+
this.writer.elementStartNS(DocxNsType.w15, 'footnoteColumns');
|
40
|
+
this.writer.writeWpIntAttr('val', properties.columnCount);
|
41
|
+
this.writer.endElement();
|
42
|
+
}
|
43
|
+
}
|
44
|
+
isDefault(properties) {
|
45
|
+
return !properties || properties.equals(NotePropertiesExporter.defaultProperties);
|
46
|
+
}
|
47
|
+
exportNoteProperties(properties) {
|
48
|
+
const defaultPosition = NotePropertiesExporter.defaultProperties.position;
|
49
|
+
if (properties.position != defaultPosition)
|
50
|
+
this.writer.writeWpStringValue("pos", WriterHelper.getValueFromTables(TranslationTables.footNotePlacementTable, properties.position, defaultPosition));
|
51
|
+
if (properties.startingNumber != NotePropertiesExporter.defaultProperties.startingNumber)
|
52
|
+
this.writer.writeWpIntValue("numStart", properties.startingNumber);
|
53
|
+
const defaultNumberingFormat = NotePropertiesExporter.defaultProperties.numberingFormat;
|
54
|
+
if (properties.numberingFormat != defaultNumberingFormat)
|
55
|
+
this.writer.writeWpStringValue("numFmt", WriterHelper.getValueFromTables(TranslationTables.pageNumberingFormatTable, properties.numberingFormat, defaultNumberingFormat));
|
56
|
+
const defaultNumberingRestartType = NotePropertiesExporter.defaultProperties.numberingRestartType;
|
57
|
+
if (properties.numberingRestartType != defaultNumberingRestartType)
|
58
|
+
this.writer.writeWpStringValue("numRestart", WriterHelper.getValueFromTables(TranslationTables.noteNumberingRestartTypeTable, properties.numberingRestartType, defaultNumberingRestartType));
|
59
|
+
}
|
60
|
+
exportFootNoteSeparators() {
|
61
|
+
this.exportNoteSeparators(this.data.model.footNoteSeparators, this.exportFootNoteSeparator.bind(this));
|
62
|
+
}
|
63
|
+
exportEndNoteSeparators() {
|
64
|
+
this.exportNoteSeparators(this.data.model.endNoteSeparators, this.exportEndNoteSeparator.bind(this));
|
65
|
+
}
|
66
|
+
exportFootNoteSeparator(separator) {
|
67
|
+
this.exportNoteSeparator('footnote', separator, this.data.footNotes);
|
68
|
+
}
|
69
|
+
exportEndNoteSeparator(separator) {
|
70
|
+
this.exportNoteSeparator('endnote', separator, this.data.endNotes);
|
71
|
+
}
|
72
|
+
exportNoteSeparators(separators, exporter) {
|
73
|
+
for (const separator of separators.getSeparatos())
|
74
|
+
exporter(separator);
|
75
|
+
}
|
76
|
+
exportNoteSeparator(tag, note, notes) {
|
77
|
+
const id = notes.get(note);
|
78
|
+
this.writer.writeWpStartElement(tag);
|
79
|
+
this.writer.writeWpIntAttr('id', id);
|
80
|
+
this.writer.endElement();
|
81
|
+
}
|
82
|
+
}
|
83
|
+
NotePropertiesExporter.defaultProperties = NoteProperties.createDefault();
|
@@ -13,4 +13,6 @@ export declare class SettingsExporter extends ExporterBaseWithRootElement {
|
|
13
13
|
private exportDocumentProtectionSettings;
|
14
14
|
private exportDocumentProtectionType;
|
15
15
|
private exportDocumentProtectionSettingsCore;
|
16
|
+
private exportFootNoteProperties;
|
17
|
+
private exportEndNoteProperties;
|
16
18
|
}
|