Utilizing Angular and TypeScript/JavaScript for testing purposes.
Each row has been formatted with a newline at the end of the code.
formattedStr += car.Name + ' | ' + car.Color + ' | ' + car.Brand + '\r\n'
The data is then exported using:
const file = new Blob([formattedStr], { type: 'text/plain' });
saveAs(file, 'myfilename');
When viewed in a .txt file, it appears like this:
Name ABC | Color A | Brand XYZ
Name ABCDEF | Color SDA | Brand ZXXYZ
Name ABCEA | Color ADS | Brand CVDRXYZ
Efforts are being made to align each row properly as follows:
Name ABC | Color A | Brand XYZ
Name ABCDEF | Color SDA | Brand ZXXYZ
Name ABCEA | Color ADS | Brand CVDRXYZ
Encountering challenges in creating dynamic indentations based on the length of the longest word in each column. Any advice?
Experimented with \t
for tab spacing but encountered issues with fixed indentation in every row, causing misalignment.
Name ABC | Color A | Brand XYZ
Name ABCDEF | Color SDA | Brand ZXXYZ
Name ABCEA | Color ADS | Brand CVDRXYZ