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

how to automatically wrap within a single cell ? #230

Open
PetterZhukov opened this issue Jun 24, 2024 · 0 comments
Open

how to automatically wrap within a single cell ? #230

PetterZhukov opened this issue Jun 24, 2024 · 0 comments

Comments

@PetterZhukov
Copy link

I use SetAutoWrapText(true) ,but it doesn't work
this is my code :
` data := [][]string{
{
"abccc\nccccccc",
"abccccccccccccccc",
"abcccccc",
"abccccccccccccccccccccc",
"abccccccccccccccccccccc\ncccccccccccccccccccccccccc\ncccccccccc",
"abccccccccccccccc",
"abccccccccccc",
"abccccccccccccccc",
"abccccccccc",
"abccccccccccccccccccc",
},
{
"abccc\nccccccc",
"abccc\ncccccccccccc",
"abccc\nccc",
"abccc\ncccccccccccccccccc",
"abccc\ncccccccccccccccccccc",
"abccc\ncccccccccccc",
"abccc\ncccccccc",
"abccc\ncccccccccccc",
"abccc\ncccccc",
"abccc\ncccccccccccccccc",
},
}
header := []string{
"abcccccccccc",
"abcdddddd",
"abceeeeeeeeee",
"abcffff",
"abcaaa",
"abceeeeeeeeeeee",
}

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.SetAutoWrapText(true)
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.AppendBulk(data)
table.SetRowLine(true)
table.SetColWidth(250)
table.SetAutoFormatHeaders(false)
table.Render()`
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