I have a project where I need to output a txt data table with fixed column widths. It's so specific, that the row positions are pre-described, like the first column is defined to be the first six characters, the next column is the next 4 characters, etc.

It could be that a module that does this already exists, but I couldn't find it.

CommentFileSizeAuthor
#2 Trim characters.jpg99.1 KBaniket.mohite88
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

baldalo’s picture

Issue summary: View changes

Same issue here.

How export as fixed column text file can be achieved?

aniket.mohite88’s picture

FileSize
99.1 KB

Hi guys,

Have you tried trimming the fields to required characters.
I mean, each field will form a column. You want the column sizes to be fixed.

Every field selected to be viewed has a "Rewrite Results" setting.

Trim Field to characters

Hope this is what you were looking for.

Regards,
Aniket

Shawn DeArmond’s picture

That's only a maximum. It doesn't solve the problem of creating a fixed-width flat table file.

timmay’s picture

Also same issue here...

sensei.by.design’s picture

I was able to make this happen by using Views PHP and using a combination of str_pad() and substr().

I hope this helps