unidoc / unioffice

Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
https://unidoc.io/unioffice/
Other
4.38k stars 473 forks source link

SetHeader Function Change Word Line Spacing #524

Open yeezyi opened 3 weeks ago

yeezyi commented 3 weeks ago

Description

after use SetHeader Func, The Paragraph LineSpacing was be changed, the verticalAlignment of Paragraph change to top

Expected Behavior

image

Actual Behavior

image

Please include a reproducible code snippet or document attachment that demonstrates the issue.

func main() {
    doc := document.New()
    defer doc.Close()

    img, err := common.ImageFromFile("gophercolor.png")
    if err != nil {
        log.Fatalf("unable to create image: %s", err)
    }

    hdr := doc.AddHeader()
    iref, err := hdr.AddImage(img)
    if err != nil {
        log.Fatalf("unable to to add image to document: %s", err)
    }

    para := hdr.AddParagraph()

    imgInl, _ := para.AddRun().AddDrawingInline(iref)
    imgInl.SetSize(1*measurement.Inch, 1*measurement.Inch)

        // -----the only different is use or not the follow line code -----
    // doc.BodySection().SetHeader(hdr, wml.ST_HdrFtrDefault)

    text := `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin lobortis, lectus dictum feugiat tempus, sem neque finibus enim, sed eleifend sem nunc ac diam. Vestibulum tempus sagittis elementum`

    para = doc.AddParagraph()
    para.SetLineSpacing(30, wml.ST_LineSpacingRuleAuto)

    run := para.AddRun()
    run.Properties().SetSize(18)
    run.AddText(text)

    para.Properties().VerticalAlignment()

    doc.SaveToFile("header-footer.docx")
}
github-actions[bot] commented 3 weeks ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

ipod4g commented 1 week ago

@yeezyi Thank you for reaching out about this issue. We'll review it and provide an update soon.

anovik commented 11 hours ago

@yeezyi I've tested both cases (with header and without header) with the latest UniOffice version (v.1.37.0) and behavior is the same, line spacing and alignment are the same for these two cases.

Could you please make sure you are using the latest version of UniOffice?