Differences in Tab Delimited files between PCs and Macs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Differences in Tab Delimited files between PCs and Macs

hallockk
Hi,

    I'm developing a program that needs to function on both Macs and PCs.  My current problem is that I'm creating a file for Excel to open, but the format is only correct on a PC.  

    I'm appending the following string:

    String HemoTotalString = StudentNames + "\t" + HemoAStr + "\t" + HemoSStr + "\t" + HemoFStr + "\t" + "Date: " + ExptDate + "\t" + "Time: " + ExptTime;

   to a file using the following command:

   IJ.append(HemoTotalString, SavingPath+TodayTeachFileName+".xls");

   When I open the file on a PC, it opens fine with each string in their individual rows, but on a Mac, the separation is messed up or non-existent.  

    Any suggestions?  

Thanks,

Kevin

----------------------------------------------
Dr. Kevin Hallock
Boston University School of Medicine
Phone: 617-414-2333
Fax: 617-414-2316
Email: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Differences in Tab Delimited files between PCs and Macs

Rick Simmons
Kevin,
I don't know if this will help you, but try saving the text file as a
comma-delineated text file.  Then use a csv extension instead of an xls
extension.  Or, (if you have difficulty writing text strings to a "csv
file"), build the file as a comma-delineated text file (using a *.txt
extension), then rename it to (or copy it to) a *.csv file when you are
done writing to it.

In Windows, Excel will automatically open a csv file (I don't know about
the Mac OS).  When the user tries to save the file when exiting Excel,
they should be asked if they want to "upgrade" the file format to xls
(or xlsx - or other).

Csv files can also be opened (as worksheets) from within MiniTab.

Rick Simmons

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Kevin Hallock
Sent: Tuesday, June 29, 2010 11:46 AM
To: [hidden email]
Subject: Differences in Tab Delimited files between PCs and Macs

Hi,

    I'm developing a program that needs to function on both Macs and
PCs.  My current problem is that I'm creating a file for Excel to open,
but the format is only correct on a PC.  

    I'm appending the following string:

    String HemoTotalString = StudentNames + "\t" + HemoAStr + "\t" +
HemoSStr + "\t" + HemoFStr + "\t" + "Date: " + ExptDate + "\t" + "Time:
" + ExptTime;

   to a file using the following command:

   IJ.append(HemoTotalString, SavingPath+TodayTeachFileName+".xls");

   When I open the file on a PC, it opens fine with each string in their
individual rows, but on a Mac, the separation is messed up or
non-existent.  

    Any suggestions?  

Thanks,

Kevin

----------------------------------------------
Dr. Kevin Hallock
Boston University School of Medicine
Phone: 617-414-2333
Fax: 617-414-2316
Email: [hidden email]

   


---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
---------------------------------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Differences in Tab Delimited files between PCs and Macs

BenTupper
Hi,

On Jun 29, 2010, at 2:08 PM, SIMMONS, RICK L [AG/1850] wrote:

> Kevin,
> I don't know if this will help you, but try saving the text file as a
> comma-delineated text file.  Then use a csv extension instead of an  
> xls
> extension.  Or, (if you have difficulty writing text strings to a "csv
> file"), build the file as a comma-delineated text file (using a *.txt
> extension), then rename it to (or copy it to) a *.csv file when you  
> are
> done writing to it.
>
> In Windows, Excel will automatically open a csv file (I don't know  
> about
> the Mac OS).  When the user tries to save the file when exiting Excel,
> they should be asked if they want to "upgrade" the file format to xls
> (or xlsx - or other).
>
> Csv files can also be opened (as worksheets) from within MiniTab.
>


If you are examining these files using text editors, then it certainly  
would be worth checking your fonts.  You might find in your Windows  
editor that the font is automatically fixed-width while in your Mac  
editor you are not using a fixed-width font.  Any editor worth its  
salt will allow you to change the fonts.

Cheers,
ben


> Rick Simmons
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Kevin Hallock
> Sent: Tuesday, June 29, 2010 11:46 AM
> To: [hidden email]
> Subject: Differences in Tab Delimited files between PCs and Macs
>
> Hi,
>
>    I'm developing a program that needs to function on both Macs and
> PCs.  My current problem is that I'm creating a file for Excel to  
> open,
> but the format is only correct on a PC.
>
>    I'm appending the following string:
>
>    String HemoTotalString = StudentNames + "\t" + HemoAStr + "\t" +
> HemoSStr + "\t" + HemoFStr + "\t" + "Date: " + ExptDate + "\t" +  
> "Time:
> " + ExptTime;
>
>   to a file using the following command:
>
>   IJ.append(HemoTotalString, SavingPath+TodayTeachFileName+".xls");
>
>   When I open the file on a PC, it opens fine with each string in  
> their
> individual rows, but on a Mac, the separation is messed up or
> non-existent.
>
>    Any suggestions?
>
> Thanks,
>
> Kevin
>
> ----------------------------------------------
> Dr. Kevin Hallock
> Boston University School of Medicine
> Phone: 617-414-2333
> Fax: 617-414-2316
> Email: [hidden email]
>
>
>
>
> ---------------------------------------------------------------------------------------------------------
> This e-mail message may contain privileged and/or confidential  
> information, and is intended to be received only by persons entitled  
> to receive such information. If you have received this e-mail in  
> error, please notify the sender immediately. Please delete it and  
> all attachments from any servers, hard drives or any other media.  
> Other use of this e-mail by you is strictly prohibited.
>
>
> All e-mails and attachments sent and received are subject to  
> monitoring, reading and archival by Monsanto, including its  
> subsidiaries. The recipient of this e-mail is solely responsible for  
> checking for the presence of "Viruses" or other "Malware". Monsanto,  
> along with its subsidiaries, accepts no liability for any damage  
> caused by any such code transmitted by or accompanying this e-mail  
> or any attachment.
> ---------------------------------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Differences in Tab Delimited files between PCs and Macs

Robert Baer
In reply to this post by hallockk
I don't know if this is the problem or not, but  the termination character
is different on windows and mac.  Windows uses CRLF whereas mac use only LF
(I think).

I'm not sure how IJ.append handles line termination, but what happens if you
explicitly supply "\n" at the end of each line?  The worst that should
happen is you would get interspersed blank lines.

Rob

----- Original Message -----
From: "Kevin Hallock" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, June 29, 2010 12:45 PM
Subject: Differences in Tab Delimited files between PCs and Macs


Hi,

    I'm developing a program that needs to function on both Macs and PCs.
My current problem is that I'm creating a file for Excel to open, but the
format is only correct on a PC.

    I'm appending the following string:

    String HemoTotalString = StudentNames + "\t" + HemoAStr + "\t" +
HemoSStr + "\t" + HemoFStr + "\t" + "Date: " + ExptDate + "\t" + "Time: " +
ExptTime;

   to a file using the following command:

   IJ.append(HemoTotalString, SavingPath+TodayTeachFileName+".xls");

   When I open the file on a PC, it opens fine with each string in their
individual rows, but on a Mac, the separation is messed up or non-existent.

    Any suggestions?

Thanks,

Kevin

----------------------------------------------
Dr. Kevin Hallock
Boston University School of Medicine
Phone: 617-414-2333
Fax: 617-414-2316
Email: [hidden email]