Skip to content

SetHeader Function Change Word Line Spacing #524

@yeezyi

Description

@yeezyi

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")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions