Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | Trim characters.jpg | 99.1 KB | aniket.mohite88 |
Comments
Comment #1
baldalo CreditAttribution: baldalo commentedSame issue here.
How export as fixed column text file can be achieved?
Comment #2
aniket.mohite88 CreditAttribution: aniket.mohite88 commentedHi 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.
Hope this is what you were looking for.
Regards,
Aniket
Comment #3
Shawn DeArmond CreditAttribution: Shawn DeArmond as a volunteer commentedThat's only a maximum. It doesn't solve the problem of creating a fixed-width flat table file.
Comment #4
timmay CreditAttribution: timmay commentedAlso same issue here...
Comment #5
sensei.by.design CreditAttribution: sensei.by.design as a volunteer commentedI was able to make this happen by using Views PHP and using a combination of str_pad() and substr().
I hope this helps