Closed Axios1027 closed 5 months ago
Hi @Axios1027, thank you for submitting an issue. So that we can help resolve this issue, can you use our bug report template and provide the following information?
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.
run this code: `async function applyHeaderStyle() { await Word.run(async (context) => {
const doc = context.document; const selecttext = doc.getSelection(); selecttext.font.name = "FZXiaoBiaoSong-B05S"; selecttext.font.size = 22; const selectparagraph = selecttext.paragraphs.getFirst() selectparagraph.alignment = "Centered" selectparagraph.spaceBefore = 0 selectparagraph.spaceAfter = 0 selectparagraph.lineSpacing = 30
await context.sync(); }) .catch(function (error) { console.log("Error: " + error); if (error instanceof OfficeExtension.Error) { console.log("Debug info: " + JSON.stringify(error.debugInfo)); } }); }`
Hi @Axios1027, thank you for for the information. I've assigned this issue to the engineering team who will be able to provide you with more information or help resolve the issue.
Cheers, Alison
@jipyua Can you please take a look at this one? Thanks.
hi @Axios1027 for the paragraph.lineSpacing api, the documentation says: "Gets or sets the line spacing, in points, for the specified paragraph. In the Word UI, this value is divided by 12." So setting it to 30 points means what UI shows 30/12= 2.5 lines.
You can try from UI to set the same formatting text/paragraph to 2.5 lines or 30 pts, you will find they are the same.
hi @Axios1027 for the paragraph.lineSpacing api, the documentation says: "Gets or sets the line spacing, in points, for the specified paragraph. In the Word UI, this value is divided by 12." So setting it to 30 points means what UI shows 30/12= 2.5 lines.
You can try from UI to set the same formatting text/paragraph to 2.5 lines or 30 pts, you will find they are the same.
Hello, I understand the conversion rules for this line spacing, but as can be clearly seen from the screenshot above me, the styles of multiple line spacing 2.5 and fixed value 30 pounds are completely different. The fixed value set through API will always be automatically converted to multiple line spacing in the UI, which is not feasible for documents with specific requirements for line spacing.
I am using an English version Word and from UI no matter whether I set it to 2.5 lines or 30 pts, the paragraph spacing looks the same. BTW, the "line spacing" means the spacing between lines, would you please try some paragraphs with multiple lines and confirm whether the line spacing are the same? Also would you please prepare a document in your environment and share it to me so that I can confirm what's the cause?
multiple line spacing 2.5 It should be very obvious from the screenshot that the display of the two types of line spacing in Word UI is different, while the js-api always automatically converts line spacing to multiple line spacing. I searched for information and found that it can be done with vba's api.
thanks for reporting this, I can reproduce it now, if the font is larger then it's more obvious. we have opened an internal item 7826968 to track this, but unfortunately, I have no detailed timeline for when this can be fixed. thanks.
Originally posted by @Axios1027 in https://github.com/OfficeDev/office-js/issues/2296#issuecomment-1459757117