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

When using the xlnt library, I encounter an xlnt::individual_attribute exception when trying to copy cell styles using the following code: #753

Open
qwwjh21 opened this issue Jan 16, 2025 · 0 comments

Comments

@qwwjh21
Copy link

qwwjh21 commented Jan 16, 2025

for (auto col = 1; col <= ws.highest_column().index; ++col)
{
xlnt::cell sourceCell = ws.cell(col, copyRow);
xlnt::cell targetCell = ws.cell(col, curRow);
xlnt::style sourceStyle = sourceCell.style();

// Copy the source cell style
targetCell.border(sourceCell.border());
targetCell.font(sourceCell.font());
targetCell.alignment(sourceStyle.alignment());

// Clear the target cell style
targetCell.clear_style();

// Attempt to set the target cell style
targetCell.style(sourceStyle);  // This line throws the xlnt::individual_attribute exception

}

Error Message:
xlnt::individual_attribute

Expected Behavior:
I expect to be able to copy the complete style of the source cell to the target cell using targetCell.style(sourceStyle) without encountering any exceptions.

Actual Behavior:
The call to targetCell.style(sourceStyle) throws the xlnt::individual_attribute exception, causing the style copying to fail.

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

1 participant