win32com模拟在Ex中执行两次全选

2024-03-28 16:49:20 发布

您现在位置:Python中文网/ 问答频道 /正文

在win32com中

cells = worksheet.UsedRange

类似于在Excel中按cntl-a一次。你知道吗

win32com相当于执行cntl-a两次什么?你知道吗

The use case is when you use the format painter after pressing cntl-a twice it will paste all the formatting including the column width.


Tags: theyouformatisuseexcelwin32comwhen
1条回答
网友
1楼 · 发布于 2024-03-28 16:49:20

我不建议你这么做。Excel认为Worksheet.UsedRange property很容易成为整个工作表(1048576行×16384列)。Range.PasteSpecial方法有粘贴格式的选项以及更合适的列宽(例如xlPasteColumnWidths)。你知道吗

在原生Excel中处理较新的工作表时,旧的roguexlCellTypeLastCell property已基本消除,但在处理跨平台编码时仍需小心。你知道吗

相关问题 更多 >