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
Add a rows before the columns headers #433
Comments
As in cell by cell or like you want to write an entire row at once? |
In the documentation I don't see any method to add row before or after a certain row. |
an entire row at once |
I need to set the headers on a different row, other than the first (A1) |
@rihabbs @getsomecoke then do:
a) Define the keys. (This process will put the key sequentially starting from column A, B, C and so on. If you want to custom it, refer to step 2b). b) Define custom keys. For example you wanna put it into column B and D
|
@mfahmirukman thanks for your help, |
@rihabbs Sorry, but I don't understand your question. Can you clarify what you meant? Edit: Did you mean that you want to have your header at row 1. E.g. from A1 to E1 and you want to have your data starting from row 2. E.g. from A2 to E2, A3 to E3, A4 to E4, so on and so forth? |
By that example, do this @rihabbs
That's about it |
@mfahmirukman thanks |
@mfahmirukman Thank you very much... you saved my time |
How do I create style in excel ? |
@mfahmirukman thanks for help. This is work when added the width. sheet.columns = [ |
Not only is your example use-case a really bad example of what a real world use-case for this might look like, it simply does not work. What most people want in this situation is to have a table header as a merged and centered cell above the row of column labels where data may then be added by key. I have tried a lot of things to get the I have tried: adding the column headers as a raw list before defining offsetting the merged title cell from the columns used in the table (as in your example) (why would anyone do this anyway?) adding rows between title and column headers (as in your example) (again why?) merging more than one row into title cell (as in your example) None of this gives me anything other than the final column key in my title cell (using Microsoft Excel). The workarounds I have found are these:
This seems a common enough use case that it would be nice to see the ability to add a table title built into the worksheet object, perhaps as a |
como se hace para ponerle mas alto a las filas ? |
prueba esto
|
thanks! saved my time! :D So I just did this AFTER defining (or below the line)
and voila! Headers in row 1 overwritten! Thanks! :D |
If anyone is having the same issue as the OP mentioned that let workbook = new Excel.Workbook();
let sheet = workbook.addWorksheet(`${reportType} Report`);
sheet.columns = [
header : "Name", key : "name",
header : "Age", key : "age",
header : "Language", key : "language",
];
sheet.mergeCells('A1','N1');
sheet.getCell('A1').value = banner;
sheet.getCell('A1').font = {
name: 'Arial Black',
family: 4,
color : { argb : '96c030' },
size: 45,
bold: true
};
sheet.getCell('A1').alignment = {
vertical : "middle", horizontal : "center"
}
sheet.mergeCells('G2','I2');
sheet.getCell('G2').value = "Powered by XYZ";
sheet.getCell('G2').font = {
name: 'Arial Black',
family: 4,
size: 10,
bold: true
};
sheet.getRow(4).values = ["Name", "Age" "Language"];
sheet.addRows(students); |
I found a more elegant and faster solution:
|
Hi,
how can i add a rows before the column header?
The text was updated successfully, but these errors were encountered: