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

Cell Styles are not updating #7

Open
VineelaKantamneni opened this issue Mar 4, 2024 · 1 comment
Open

Cell Styles are not updating #7

VineelaKantamneni opened this issue Mar 4, 2024 · 1 comment

Comments

@VineelaKantamneni
Copy link

Hi, I set a cell alignment to the right & after setting the style to one cell I updated the alignment of a style to the left.
But I'm getting both the cell's alignment left in the output. Could you help me to fix this?

`CellStyle style1 = wb.createCellStyle();
style1.setAlignment(CellStyle.ALIGN_RIGHT);

HSSFCell hssfCell = row1.createCell(j);
String val = "200";
hssfCell.setCellValue(Integer.parseInt(val));
hssfCell.setCellStyle(style1);

HSSFCell hssfCell2 = row1.createCell(j);
val = "300";
hssfCell2.setCellValue(Integer.parseInt(val));
style1.setAlignment(CellStyle.ALIGN_LEFT);
hssfCell2.setCellStyle(style1);`

Thanks in advance

@T5750
Copy link
Owner

T5750 commented Mar 5, 2024

CellStyle style1 = wb.createCellStyle();
style1.setAlignment(CellStyle.ALIGN_RIGHT);

HSSFCell hssfCell = row1.createCell(j);
String val = "200";
hssfCell.setCellValue(Integer.parseInt(val));
hssfCell.setCellStyle(style1);

HSSFCell hssfCell2 = row1.createCell(j);
val = "300";
hssfCell2.setCellValue(Integer.parseInt(val));
CellStyle style2 = wb.createCellStyle();
style2.setAlignment(CellStyle.ALIGN_LEFT);
hssfCell2.setCellStyle(style2);

Hi, I hope this can help you.

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