![](/img/trans.png)
[英]Copy data from conditional formatted cells to new tab based on the conditional formatting color in Excel
[英]Copy formatted (cell color/merged cells) data from one excel to another changes color - win32/python
嘗試復制某些格式的數據-使用Win32將單元格顏色以及合並的單元格從一個Excel合並到另一個。 在這種情況下,它從紫色變為怪異的棕色。
xlPasteFormats= -4122
source.Worksheets('Summary').Range("I%d:P%d" %(start,end)).Copy()
xlSheet.Range('B1:I2').PasteSpecial(-4163) #Pastes data
xlSheet.Range('B1:I2').PasteSpecial(xlPasteFormats) #Pastes the format
這很可能是由於工作簿的主題顏色不同(假設源工作表和目標工作表在不同的工作簿中)。 一種解決方案是更改目標工作簿的主題顏色以匹配源工作簿。 這可以手動完成,也可以在代碼中完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.