Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
XLWTの使いやすさに非常に感銘を受けましたが、その方法がわからないことが1つあります。特定の行を、すべての文字を表示するために必要な最小幅に調整しようとしています(つまり、セル間の仕切りをダブルクリックした場合にExcelで何ができるか)。
列幅を所定の量に調整する方法は知っていますが、すべてを表示するために必要な最小幅を決定する方法がわかりません。
幅は、デフォルトフォントのゼロ文字の幅の1/256です。十分な概算は次のとおりです。
def get_width(num_characters): return int((1+num_characters) * 256)