Results 1 to 9 of 9
Thread: Text file format lost in AIX
- 07-26-2011, 09:54 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Text file format lost in AIX
I am using RAD in Windows Environment I developed application which will throw the .txt file to the user(basically user can download a file from the server).
* This works fine in windows environment.
* But when I move the code to AIX environment then the user download the file but the alignment is messed up.
The code goes like this....
String filePath = System.getProperty("BIOP_FILE_GEN_PATH");
file = new File(filePath);
fis = new FileInputStream( file );
int len = fis.available();
byte byteArray[] = new byte[len];
fis.read(byteArray);
response.setContentType( "application/text" );
response.setHeader("Content-Disposition", "attachment; filename=\"" + input.getID_NAME_FILE() +"\"");
response.setContentLength( len );
response.getOutputStream().write( byteArray, 0, len );
response.getOutputStream().flush();
response.getOutputStream().close();
Anybody have any idea?
Thanks in advance
- 07-26-2011, 11:04 PM #2
Can you explain what the "alignment" of a text file is?the alignment is messed up.
How do you see that it is not aligned?
Are you using tabs? The spacing for a tab is user/app settable.
- 07-26-2011, 11:28 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Thanks for your reply.
The original file looks like this...
************************************************** *********************
* NAME * FOR PERIOD: 06/30/11 - 07/06/11 *
* JERSEY * ABC *
************************************************** *********************
Becomes like this when it comes to client ...
************************************************** ********************* * NAME * FOR PERIOD: 06/30/11 - 07/06/11 *
* JERSEY * ABC * ************************************************** ************
This file I got it from one of my vendor and they used tabs for formatting.
- 07-26-2011, 11:36 PM #4
Looks like line ends and tabbing problem.
Tabbing can vary from one program to another. Better to not use them unless you know what the tab setting are in the program that will display the data.
Seems there are several different line ends. Some take CR, some take LF and some take both.
I guess you need to know what your target machine is using.
- 07-26-2011, 11:56 PM #5
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
My target users are windows(IE8) but my server is AIX.
But this works fine in windows region(Local RAD & IE8), it fails only I move the code and file to AIX server.
If I change the file extension from .txt to .doc then it retains the format. But the end user has to change the Page Setup to "Landscape" and print in Legal Paper, then only the end user can able to see the full content.
Is there anyway in which I can force the document to be viewed in "Landscape"
- 07-27-2011, 03:14 AM #6
I don' think there is any formatting information in text file other than things like tabs and lineends.
- 07-27-2011, 09:05 AM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,377
- Blog Entries
- 7
- Rep Power
- 17
My guess is that it's a \r\n (MS Windows) versus \n (Unix etc.) thingy.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-27-2011, 09:39 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Quite.
How is that file generated?
That's the key, since that code up there is simply streaming an existing file back to the client.
- 07-27-2011, 03:39 PM #9
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Trying to get correct text format in .txt file
By patriotsfan in forum New To JavaReplies: 14Last Post: 06-06-2011, 02:29 AM -
Text format in JTextArea
By goodlily in forum AWT / SwingReplies: 4Last Post: 04-10-2011, 11:57 PM -
Text/String format..??
By Neullson in forum New To JavaReplies: 14Last Post: 07-23-2010, 08:51 AM -
Format some text with Java
By vampire in forum New To JavaReplies: 0Last Post: 02-18-2010, 06:45 AM -
Text Format Error
By MrFish in forum New To JavaReplies: 2Last Post: 01-13-2010, 01:06 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks