-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Inconsistent Comment Box Shape #1707
Comments
Thanks for your issue. Which version of the Excelize library are you using? Could you show us a complete, standalone example program or reproducible demo? If you open an existing workbook, please provide the file attachment without confidential info. |
Excelize Version: "github.com/xuri/excelize/v2" Standalone Example Program: package main
import (
"fmt"
"github.com/xuri/excelize/v2"
)
func main() {
xlsx, err := excelize.OpenFile(LocationFile)
if err != nil {
fmt.Println("Failed to open the file:", err)
}
sheetName := "Sheet1"
// Add data and comments
xlsx.SetCellValue(sheetName, "A1", "ID Subkategori")
xlsx.SetCellValue(sheetName, "C1", "Kode Paket")
errorText := "Example error message for demonstration."
xlsx.AddComment(sheetName, excelize.Comment{
Cell: "A1",
Author: "System",
Text: errorText,
Paragraph: []excelize.RichTextRun{
{Text: "System: ", Font: &excelize.Font{Bold: true}},
{Text: errorText},
},
})
xlsx.AddComment(sheetName, excelize.Comment{
Cell: "D1",
Author: "System",
Text: errorText,
Paragraph: []excelize.RichTextRun{
{Text: "System: ", Font: &excelize.Font{Bold: true}},
{Text: errorText},
},
})
// Save the file
err := xlsx.SaveAs("SampleWorkbook.xlsx")
if err != nil {
fmt.Println("Failed to save the file:", err)
}
} This standalone example utilizes an existing Excel workbook from a local directory with two cells containing comments. As outlined in the issue. The comment in column D might appear arrow-shaped, while the comment in the "ID Subkategori" column appears rectangle-shaped. Existing Workbook: I've attached a sample Excel file for your reference. |
Previously, I was using the package "github.com/360EntSecGroup-Skylar/excelize", and the Comment Box Shape was working fine. However, since that package didn't support deleting comments, I searched online and found a solution by using the package "github.com/xuri/excelize/v2", which has a feature to delete comments. However, I encountered this issue with it. |
Which version of the Excelize library are you using? There are multiple released versions in v2. The comments on cells B1 and C1 in your attachment were not created by this library, right? In your code, the sheet name "Sheet1" doesn't exist in the workbook "00001_example.xlsx", so the comment will not created on cells A1 and D1. If you receive the error returned by the |
The version is v2.8.0, I have the same project with the reporter. Thank you very much. |
Hi @rezasklggwp, thanks for your feedback. Could you show us a complete, standalone example program or reproducible demo? If you open an existing workbook, please provide the file attachment without confidential info. |
It seems still not have enough info of code and attachments to reproduce this issue, so I'll close this issue, if you have any questions, please let me know to reopen this anytime. |
Hi @here-bossnanda, @rezasklggwp, this issue similar with the issue #672, and it has been fixed in the #673 in v2.3.0. |
Description:
When using the excelize library to add comments to cells in an Excel file, I'm observing inconsistent rendering of the comment boxes. Specifically:
For some cells, even with short comment text, the comment is rendered as an arrow-shaped callout.
For other cells, with longer comment text, the comment appears as the expected rectangle shape.
This behavior is inconsistent and seems to be unrelated to the actual length of the comment text. For instance, comments in column D with a longer text are rendered as arrow-shaped, while comments in the "ID Subcategory" column with shorter text are rendered as rectangles.
Code Sample:
Expected Behavior:
All comment boxes, regardless of text length, should render consistently, preferably as rectangles.
Actual Behavior:
Comment boxes render inconsistently between arrow-shaped callouts and rectangles, seemingly unrelated to the actual comment text length.
Additional Information:
I've tested the generated file in ms excel version 16.78.3 , and the issue persists.
I'd appreciate any insights or fixes for this issue. Thanks!
The text was updated successfully, but these errors were encountered: