I want to copy/paste range at worksheet including the values/property(Strikethrough) in the cells to another new workbook.
I can't set this property at new sheet. Using Microsoft.Office.Interop.Excel;
I cant copy this property like in the picture. How can I do it. 3 line in 1 cell with different property
public void WriteCellWithFont(int i, int j , _Excel.Range cell)
{
i++;
j++;
ws.Cells[i, j].Value2 = cell.Value2;
ws.Cells[i,j].Font.Strikethrough = true;
}
Try with PasteSpecial. Its like normal way of we use to keep formatting when paste.
// copy
Range cells1 = (Range)worksheet1.Cells[2, 3];
cells1.Copy();
// Paste
Range cells2= (Range)worksheet2.Cells[2, 3];
cells2.PasteSpecial(XlPasteType.xlPasteFormats);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.