Skip to main content
Solved

How to control Excel column width a FeatureWriter.

  • January 20, 2022
  • 5 replies
  • 790 views

datablue
Contributor
Forum|alt.badge.img+7

I'm fairly new to FME Desktop. I have a FeatureWriter with three inputs. I'm creating an Excel file with three sheets. It works great except many of the column widths are much wider than the content. I have to open each sheet, select all columns and Auto Fit Column Width.

 

Today I realized that if the data type is text(255) then the column width will be 255. If the data type is text(150) then the column width will be 150. My data source is an ArcGIS feature layer created from Survey123. The default length for a text field is 255 so, I have many columns that with a width of 255 in Excel. This doesn't seem like a great way to determine width. I'd rather go with the Excel default column width.

 

In the User Attributes tab of the FeatureWriter parameters, I see that I can set the column width. I believe that I can use zero to auto fit the column width. The problem is that I have about 30 columns and 3 sheets so, I'd have to type '0' close to hundred times. Is there a better way? Thanks.

Best answer by ebygomm

If you highlight the attributes to change, you only need to type the new value once, it will update all selected attributes

image

View original
Did this help you find an answer to your question?

5 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

You can import this. Prepare an excel document as you like (copy the data including columns from the Visual Preview / Data Inspector, paste in Excel, fix column widths), then create the writer or configure the FeatureWriter, import the sheets and the column widths will imported with the column names.

 

As an alternative you can use the prepared file as a template for the writer, remove the data (not the columns) and set it as a template.

 

WriterParametersFeatureWriterParameters


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • January 21, 2022

If you highlight the attributes to change, you only need to type the new value once, it will update all selected attributes

image


datablue
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • January 21, 2022
ebygomm wrote:

If you highlight the attributes to change, you only need to type the new value once, it will update all selected attributes

image

Thanks. I think that this is what I want, but I can't change the cell width unless I change the Attribute Definition to Manual or Dynamic. When I do that my Excel sheet name changes (first item in the Feature Types list) and the sheet is no longer written out properly. I'm new to FME and have a feeling I'm making simple mistakes.

 

image


datablue
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • January 25, 2022
nielsgerrits wrote:

You can import this. Prepare an excel document as you like (copy the data including columns from the Visual Preview / Data Inspector, paste in Excel, fix column widths), then create the writer or configure the FeatureWriter, import the sheets and the column widths will imported with the column names.

 

As an alternative you can use the prepared file as a template for the writer, remove the data (not the columns) and set it as a template.

 

WriterParametersFeatureWriterParameters

Thanks for letting me know about this capability.


datablue
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • January 25, 2022
datablue wrote:

Thanks. I think that this is what I want, but I can't change the cell width unless I change the Attribute Definition to Manual or Dynamic. When I do that my Excel sheet name changes (first item in the Feature Types list) and the sheet is no longer written out properly. I'm new to FME and have a feeling I'm making simple mistakes.

 

image

I reviewed this again. If I click on Manual only, then the sheet name doesn't change. Your suggestion works great. Thanks.

 

When I first tried this, I clicked on Dynamic then clicked on Manual. That changed the sheet’s name. I guess that I’m a beginner!

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings