Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#916 Add overflow punctuation #2478

Merged
merged 2 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/file/paragraph/properties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ describe("ParagraphProperties", () => {
});
});

it("should create with the overflowPunct property", () => {
const properties = new ParagraphProperties({
overflowPunctuation: true,
});
const tree = new Formatter().format(properties);

expect(tree).to.deep.equal({
"w:pPr": [
{
"w:overflowPunct": {},
},
],
});
});

it("should create with the run property", () => {
const properties = new ParagraphProperties({
run: {
Expand Down
5 changes: 5 additions & 0 deletions src/file/paragraph/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
readonly frame?: IFrameOptions;
readonly suppressLineNumbers?: boolean;
readonly wordWrap?: boolean;
readonly overflowPunctuation?: boolean;
readonly scale?: number;
/**
* This element specifies whether inter-character spacing shall automatically be adjusted between regions of numbers and regions of East Asian text in the current paragraph. These regions shall be determined by the Unicode character values of the text content within the paragraph.
Expand Down Expand Up @@ -152,6 +153,10 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
this.push(new WordWrap());
}

if (options.overflowPunctuation) {
this.push(new OnOffElement("w:overflowPunct", options.overflowPunctuation));
}

/**
* FIX: Multitab support for Libre Writer
* Ensure there is only one w:tabs tag with multiple w:tab
Expand Down