Watermark
Watermark feature aims to provide a flexible and secure watermark solution for spreadsheets. It allows developers to add text or image watermarks to spreadsheets and offers various configuration options to customize the appearance and behavior of the watermark.
Preset Mode
Watermark does not provide a preset, but it supports mixing with its plugins.
Installation
npm install @univerjs/watermarkUsage
import { UniverWatermarkPlugin } from '@univerjs/watermark'
import '@univerjs/watermark/facade'
const { univerAPI } = createUniver({
// ...
presets: [
UniverSheetsCorePreset(),
],
plugins: [
[UniverWatermarkPlugin, {
textWatermarkSettings: {
content: 'Hello, Univer!',
fontSize: 36,
},
}],
],
})Plugin Mode
Installation
npm install @univerjs/watermarkUsage
import { UniverWatermarkPlugin } from '@univerjs/watermark'
import '@univerjs/watermark/facade'
const univer = new Univer({
// ...
})
univer.registerPlugin(UniverWatermarkPlugin, {
textWatermarkSettings: {
content: 'Hello, Univer!',
fontSize: 36,
},
}) Plugins and Configuration
@univerjs/watermark
This plugin provides the core implementation of watermark functionality. It allows developers to add text or image watermarks to applications and offers various configuration options to customize the appearance and behavior of the watermark. It provides the UniverWatermarkPlugin plugin.
Reference: @univerjs/watermark
Facade API
Importing
Plugin mode note
Only plugin mode requires manually importing the Facade package. Preset mode already includes the corresponding Facade package, so no extra import is needed.
import '@univerjs/watermark/facade'Set Watermark
univerAPI.addWatermark('text', { content: 'hello', repeat: true })Remove Watermark
univerAPI.deleteWatermark()How is this guide?
