指南Univer Sheets功能打印Pro

打印

Facade API付费版本需要 Univer 服务端Univer on Node.jsPreset
--UniverSheetsAdvancedPreset

Univer 提供了高精度的打印功能,支持打印预览、打印设置,以及导出为 PDF。

该功能包含以下插件包:

Presets 安装

import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreZhCN from '@univerjs/presets/preset-sheets-core/locales/zh-CN';
import { UniverSheetsAdvancedPreset } from '@univerjs/presets/preset-sheets-advanced';
import UniverPresetSheetsAdvancedZhCN from '@univerjs/presets/preset-sheets-advanced/locales/zh-CN';
 
const { univerAPI } = createUniver({
  locale: LocaleType.ZH_CN,
  locales: {
    zhCN: Tools.deepMerge(
      {},
      UniverPresetSheetsCoreZhCN,
      UniverPresetSheetsAdvancedZhCN,
    ),
  },
  theme: defaultTheme,
  presets: [
    UniverSheetsCorePreset(),
    UniverSheetsAdvancedPreset(),
  ],
});

高级安装

npm install @univerjs-pro/sheets-print
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsPrintPlugin } from '@univerjs-pro/sheets-print'
import SheetsPrintPluginZhCN from '@univerjs-pro/sheets-print/locale/zh-CN';
 
import '@univerjs-pro/sheets-print/lib/index.css';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.ZH_CN,
  locales: {
    [LocaleType.ZH_CN]: Tools.deepMerge(
      SheetsPrintPluginZhCN
    ),
  },
});
 
univer.registerPlugin(UniverSheetsPrintPlugin);