Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

How to set all columns width to autofit (based on content in cell)

$
0
0

Hi,

I have defined columns something like this:

Worksheet worksheet = new Worksheet(); 

Columns xlCols = new Columns(); 
Column xlCol = new Column(); 
xlCol.Width = 20; 
xlCol.BestFit = true; 
xlCol.CustomWidth = true; 
xlCol.Min = 2; 
xlCol.Max = 6; 
xlCols.Append(xlCol); 

xlCol = new Column(); 
xlCol.Width = 30; 
xlCol.BestFit = true; 
xlCol.CustomWidth = true; 
xlCol.Min = 7; 
xlCol.Max = 9; 
xlCols.Append(xlCol); 

worksheet.Append(xlCols); 

Eventhough BestFit = true, still all columns width is 30 only.

and I cannot find anything such as

xlCols.AutoFit(); in openxml sdk

Could someone please help me on this?



Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>