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

column each cell issue #2306

Open
yixiantan opened this issue Jul 18, 2023 · 17 comments
Open

column each cell issue #2306

yixiantan opened this issue Jul 18, 2023 · 17 comments

Comments

@yixiantan
Copy link

image

why the eachCell function only fill the color until 9 row

@zurmokeeper
Copy link
Contributor

@yixiantan Can you post the full code? And the generated excel file?

@yixiantan
Copy link
Author

@yixiantan Can you post the full code? And the generated excel file?

image

i found the each cell function only will return which row that has value, i mean if the second row don have any value, then it only fill up the color for the first row.

If second row have value and third row don have value then it only will fill up the first row & second row color

@zurmokeeper
Copy link
Contributor

@yixiantan Can you post the code instead of a picture?

@yixiantan
Copy link
Author

yixiantan commented Jul 20, 2023

@yixiantan Can you post the code instead of a picture?

ohhh...sry, sure

let workbook = new Excel.Workbook();
    let sheet = workbook.addWorksheet("example");
    const list = ["example 1", "example 2", "example 2"];
    sheet.addRow(list, "i");
    const column = sheet.getColumn(1);

    column.eachCell({ includeEmpty: true }, (cell, rowNumber) => {
      cell.fill = {
        type: "pattern",
        pattern: "solid",
        fgColor: {
          argb: "FF85c8ff",
        },
      };
    });

    let buffer: Excel.Buffer = await workbook.xlsx.writeBuffer();

    let base64 = Buffer.from(buffer).toString("base64");

    return base64;

@zurmokeeper
Copy link
Contributor

@yixiantan You want to set the color for the whole column regardless of whether the cell has a value or not, right?

@yixiantan
Copy link
Author

@yixiantan You want to set the color for the whole column regardless of whether the cell has a value or not, right?

image

ya, but not for whole column, it depend on my first column, like example i just need to set A2 to C9999 column

@yixiantan
Copy link
Author

@yixiantan You want to set the color for the whole column regardless of whether the cell has a value or not, right?

is that anywhere to let me get range of cell?

@zurmokeeper
Copy link
Contributor

@yixiantan Are you trying to set the color of all the cells in the range A2-C9999? Is that what you mean?

@yixiantan
Copy link
Author

@yixiantan Are you trying to set the color of all the cells in the range A2-C9999? Is that what you mean?

yaya

@zurmokeeper
Copy link
Contributor

@yixiantan Are you trying to set the color of all the cells in the range A2-C9999? Is that what you mean?

yaya

You're a bit of a pain in the ass with this one. It'll take a while.

@yixiantan
Copy link
Author

@yixiantan Are you trying to set the color of all the cells in the range A2-C9999? Is that what you mean?

yaya

You're a bit of a pain in the ass with this one. It'll take a while.

I research for this quite long time but still cannot do it

@zurmokeeper
Copy link
Contributor

@yixiantan Instead of answering here in the follow-up, which keeps jumping around, I'll create a new one here with the same question, and I'll respond here in the follow-up. link:

@zurmokeeper
Copy link
Contributor

@yixiantan I've already realized that the comment stays over there。

@yixiantan
Copy link
Author

the comment stays o

alright, thanks

@zurmokeeper
Copy link
Contributor

@yixiantan You can try the code and see if it works the way you want it to.

@yixiantan
Copy link
Author

@yixiantan You can try the code and see if it works the way you want it to.

it's working fine, thanks

@zurmokeeper
Copy link
Contributor

@yixiantan You can try the code and see if it works the way you want it to.

it's working fine, thanks

@yixiantan You can follow up on this project(excelize), after all, exceljs has been largely un-updated.

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