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

Compatibility issues between Windows and MacOS platforms #10

Open
zjzjzjzj1874 opened this issue Jan 9, 2025 · 0 comments
Open

Compatibility issues between Windows and MacOS platforms #10

zjzjzjzj1874 opened this issue Jan 9, 2025 · 0 comments

Comments

@zjzjzjzj1874
Copy link

I am trying to generate a word.docx; Then I opened it between macOS and Windows, and its performance was different on the two platforms.

import (
	"baliance.com/gooxml/color"
	"baliance.com/gooxml/common"
	"baliance.com/gooxml/document"
	"baliance.com/gooxml/measurement"
	"baliance.com/gooxml/schema/soo/wml"
)

table := doc.Document.AddTable()
	table.Properties().SetStyle(t.Style) 
	table.Properties().SetWidth(t.Width)      // t.Width = 404.6
	table.Properties().SetAlignment(t.Alignment)
	table.Properties().SetLayout(t.Layout)
	table.Properties().Borders().SetAll(wml.ST_BorderThick, color.Black, 1)

	for _, row := range t.Rows {
		r := table.AddRow()
		r.Properties().SetHeight(row.Height, row.Rule)
		for _, cell := range row.Cells {
			c := r.AddCell()
			p := c.AddParagraph()
			run := p.AddRun()
			run.AddText(cell.Value)
			run.Properties().SetSize(cell.Size)
			run.Properties().SetBold(cell.Bold)
			c.Properties().SetVerticalAlignment(cell.VerticalAlignment)
			if cell.WidthAuto {
				c.Properties().SetWidthAuto()
			}
			run.Properties().SetBold(cell.Bold)
			if cell.Width != 0 {
				c.Properties().SetWidth(cell.Width)  // t.Width = 143.3
			}
			run.Properties().SetColor(cell.Color)
		}
	}

However, the tables on the two platforms have different column widths.

On MacOS:
WechatIMG4

On Windows:
WechatIMG3

Is there a solution to the problem of different platform widths?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant