SharePoint users have a tendency to create All Items views containing almost every column in their lists. In cases like these, the readability is often poor, and SharePoint gives users no ability to format the cells appropriately (such as text alignment, column width, etc). One case where this is most disrupting is for multi-line text columns. Single line text columns have a CSS width setting, but multi-line columns depend on the user including a sensible amount of columns to view. The image below illustrates this circumstance.
There are a few available options to improve the readability of multi-line columns:
- Make the column name really really long
- Create a Datasheet view where column size settings are preserved (this option isn’t applicable to users browsing with anything except Internet Explorer)
- Modify the
FLDTYPES.XMLfile to set a fixed width in HTML - Create the same effect as option #3 by employing a new custom field with modified rendering (thus avoiding unrecommended toying with
FLDTYPES.XML)
Despite the modification of FLDTYPES.XML being unrecommended and unsupported, I went for option #3. It’s a simple and fairly unimposing change. There are two caveats though:
- This change will force a minimum width on all multi-line text fields on all display modes of all webs on the server
- The change will be lost if WSS is reinstalled, as it is not stored in the database
The code snippet below shows the two lines I added to FLDTYPES.XML to make multi-line text columns display with a minimum width of 300 pixels. Note that the CSS min-width attribute is not applicable in IE, so width is used to similar effect. Don’t forget to restart the IIS server after changes made to FLDTYPES.XML.
<FieldType> <Field Name="TypeName">Note</Field> <Field Name="TypeDisplayName">$Resources:core,fldtype_note;</Field> <Field Name="InternalType">Note</Field> <Field Name="SQLType">ntext</Field> <Field Name="ParentType"></Field> <Field Name="FieldTypeClass">Microsoft.SharePoint.SPFieldMultiLineText</Field> <Field Name="Sortable">FALSE</Field> <Field Name="Filterable">FALSE</Field> <RenderPattern Name="HeaderPattern"> <HTML><![CDATA[<div style="width: 300px">]]></HTML> <FieldSwitch> <Expr><GetVar Name='Filter'/></Expr> <Case Value="1"> <FieldSwitch> <Expr><Property Select="aggregation"/></Expr> <Case Value="merge"> <HTML><![CDATA[<INPUT TYPE="TEXT" MAXLENGTH="256" CLASS="ms-input" ID="diidFilter]]></HTML> <Property Select='Name'/> <HTML><![CDATA[" OnKeyPress='FilterNoteField("]]></HTML> <GetVar Name="View"/> <HTML><![CDATA[",]]></HTML> <ScriptQuote><Property Select='Name' URLEncode="TRUE"/></ScriptQuote> <HTML><![CDATA[,this.value, event.keyCode);' OnChange='FilterNoteField("]]></HTML> <GetVar Name="View"/><HTML><![CDATA[",]]></HTML> <ScriptQuote><Property Select='Name' URLEncode="TRUE"/></ScriptQuote> <HTML><![CDATA[,this.value, 13);'/>]]></HTML> <HTML><![CDATA[<BR>]]></HTML> </Case> <Default/> </FieldSwitch> </Case> <Default/> </FieldSwitch> <Property Select="DisplayName" HTMLEncode="TRUE"/> <HTML><![CDATA[<IMG SRC="]]></HTML><FieldFilterImageURL/> <HTML><![CDATA[" BORDER=0 ALT=]]></HTML><HTML>$Resources:core,550;</HTML> <HTML><![CDATA[>]]></HTML> <HTML><![CDATA[</div>]]></HTML> </RenderPattern> ... </FieldType>