Add after for toc styles (#806)

* fix: add after for preset toc styles

* fix: update
main
bokuweb 2025-03-07 16:41:58 +09:00 committed by GitHub
parent 9b8c8b6e97
commit 1137e291a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -135,6 +135,11 @@ impl Style {
self
}
pub fn line_spacing(mut self, spacing: LineSpacing) -> Self {
self.paragraph_property = self.paragraph_property.line_spacing(spacing);
self
}
pub fn indent(
mut self,
left: Option<i32>,

View File

@ -2,9 +2,11 @@ use crate::documents::*;
use crate::types::*;
pub fn toc(level: i32) -> Style {
let spacing = LineSpacing::new().after(100);
Style::new(format!("ToC{}", level), StyleType::Paragraph)
.name(format!("toc {}", level))
.align(AlignmentType::Both)
.snap_to_grid(false)
.indent(Some((level - 1) * 200), None, None, Some((level - 1) * 100))
.line_spacing(spacing)
}

View File

@ -1,6 +1,6 @@
{
"name": "docx-wasm",
"version": "0.4.18-rc39",
"version": "0.4.18-rc40",
"main": "dist/node/index.js",
"browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>",