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

Adding information about the author of the comment. #403

Open
CamilYed opened this issue Mar 18, 2024 · 2 comments
Open

Adding information about the author of the comment. #403

CamilYed opened this issue Mar 18, 2024 · 2 comments

Comments

@CamilYed
Copy link

CamilYed commented Mar 18, 2024

Hi,
could you extend the fast-excel API with the ability to add, also, information about the author of the comment?

After generating the excel file, I unfortunately have a rather ugly comment.

image

The current implementation as you can see is quite flawed.

    void writeComments(Writer w) throws IOException {
        w.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        w.append("<comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
        w.append("<authors><author/></authors>");
        w.append("<commentList>");
        for (Map.Entry<Location, String> entry : cache.entrySet()) {
            Location location = entry.getKey();
            w.append("<comment ref=\"");
            w.append(location.toString());
            w.append("\" authorId=\"0\"><text><t>");
            w.appendEscaped(entry.getValue());
            w.append("</t></text></comment>");
        }
        w.append("</commentList></comments>");
    }

https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.comments?view=openxml-3.0.1

@meiMingle
Copy link
Collaborator

Can you upload an Excel file to show the style you want?

@CamilYed
Copy link
Author

CamilYed commented Apr 6, 2024

I would like to have an api e.g. by builder pattern to enable building a comment.

new CellComment.Builder()
    .withAuthor("Some author name")
    .withComment("Some text")
    .withDate(date, "MM-dd-yyyy HH:mm) // or  .withDate(date, "MM-dd-yyyy) // or 
    .withStyle(new CommentStyle.Builder()
        .withFontSize(19)
        .withFontName("Tahoma")
        .withColor("Green")
       // etc
    );

as allowed by the ooxml standard.

All options should be optionals.
So in my case I need only:

new CellComment.Builder().withComment("Some text");

I use LibreOffice on a daily basis, but in Google Docs, I also see a similar comment. I would like to have only the text itself, and if the standard does not allow it, I would like to be able to set the author of the comment.

image

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

2 participants