Hi..
I remembered that I had tried this before, but couldn't implement it.
When I tried this, the problem that occurred is as follows.
1. My sheet's LastColumn is 5, but Spire recognizes it as 7.
2. The cell's border type doesn't seem to be applied.
I added this code to the CopyStyle method, but it didn't worked.
- Code: Select all
switch (xCell.Borders.Value) {
case LineStyleType.None:
wCell.CellFormat.Borders.BorderType = Spire.Doc.Documents.BorderStyle.None;
break;
case LineStyleType.Thin:
wCell.CellFormat.Borders.BorderType = Spire.Doc.Documents.BorderStyle.ThinThickSmallGap;
break;
}
3. It seems that the width and height of the cells are not applied properly.
`table.Rows[r - 1].Height = (float)sheet.Rows[r - 1].RowHeight;` This code doesn't seem to work,
so I added this to the `CopyStyle` method.
But it still didn't worked.
- Code: Select all
wCell.SetCellWidth( (float)xCell.ColumnWidth, CellWidthType.Auto);
wCell.OwnerRow.Height = (float)xCell.RowHeight;
I want to know why this code doesn't work.
There are Excel used for attachments, doc files created using spire, and files directly opened and pasted.
the Excel file may have a different display when the PC's default page is A4 and letter.
On my PC, A4 is the default page, and I have attached a screenshot when I open the Excel file.
Login to view the files attached to this post.