473,698 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comma-delimited file format?

Hi!

I have written a little class in .NET to convert a DataTable or a
dataView to a comma-delimited text file. This file eventually gets
imported in Excel or Word.

Everything works great, I handled commas and quotes and Excel reads my
files correctly. I have one little problem, though... If a field in the
datatable has a carriage return in it, it gets written to the text file
(of course) and Excel things it's the start of a new record.

Is there a special character I can replace the CR with so Excel knows
that it is not a new record but a CR inside a field?

Thank you!

Carl

Jul 21 '05 #1
4 11260
Carl,
Try replacing CRLF (hex OD OA) with just the line feed character (hex 0A).

William

"Carl Mercier" <in**@carl-mercier.nojunkp lease.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi!

I have written a little class in .NET to convert a DataTable or a
dataView to a comma-delimited text file. This file eventually gets
imported in Excel or Word.

Everything works great, I handled commas and quotes and Excel reads my
files correctly. I have one little problem, though... If a field in the
datatable has a carriage return in it, it gets written to the text file
(of course) and Excel things it's the start of a new record.

Is there a special character I can replace the CR with so Excel knows
that it is not a new record but a CR inside a field?

Thank you!

Carl

Jul 21 '05 #2
William,

It didn't work unfortunately. Do you have any other idea?

Thanks!

Carl


William Leung wrote:
Carl,
Try replacing CRLF (hex OD OA) with just the line feed character (hex 0A).

William

"Carl Mercier" <in**@carl-mercier.nojunkp lease.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi!

I have written a little class in .NET to convert a DataTable or a
dataView to a comma-delimited text file. This file eventually gets
imported in Excel or Word.

Everything works great, I handled commas and quotes and Excel reads my
files correctly. I have one little problem, though... If a field in the
datatable has a carriage return in it, it gets written to the text file
(of course) and Excel things it's the start of a new record.

Is there a special character I can replace the CR with so Excel knows
that it is not a new record but a CR inside a field?

Thank you!

Carl



Jul 21 '05 #3
Carl,

I'm using Excel from office XP and it did work for me. However, I would
expect it should work for all version of Excel. What you can do to get the
format of the file correct is to examine a CSV file that Excel creates
itself. Create an Excel sheet with a cell that has a carriage return in it,
(To do this use the ALT+Enter key combo while editing) and then in the SAVE
AS dialog box change the file type to CSV. Examine the file using a hex
editor.

Hope this helps,

William.

"Carl Mercier" <in**@carl-mercier.nojunkp lease.com> wrote in message
news:O5******** ******@TK2MSFTN GP10.phx.gbl...
William,

It didn't work unfortunately. Do you have any other idea?

Thanks!

Carl


William Leung wrote:
Carl,
Try replacing CRLF (hex OD OA) with just the line feed character (hex 0A).
William

"Carl Mercier" <in**@carl-mercier.nojunkp lease.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi!

I have written a little class in .NET to convert a DataTable or a
dataView to a comma-delimited text file. This file eventually gets
imported in Excel or Word.

Everything works great, I handled commas and quotes and Excel reads my
files correctly. I have one little problem, though... If a field in the
datatable has a carriage return in it, it gets written to the text file
(of course) and Excel things it's the start of a new record.

Is there a special character I can replace the CR with so Excel knows
that it is not a new record but a CR inside a field?

Thank you!

Carl


Jul 21 '05 #4
In news:%2******** ********@TK2MSF TNGP09.phx.gbl,
William Leung <NO***********@ optonline.net> posted:
... Create an Excel sheet with a cell that has a
carriage return in it, (To do this use the ALT+Enter key combo while
editing) and then in the SAVE AS dialog box change the file type to
CSV. Examine the file using a hex editor.


My strings were separated by OA, just as you suggested.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@mvps.org, www.cindywinegarden.com
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
4561
by: Alberto Vera | last post by:
Hello: I have the next structure: How Can I make it using Python? How Can I update the value of 6?
5
2561
by: Derek | last post by:
I came upon the idea of writting a logging class that uses a Python-ish syntax that's easy on the eyes (IMO): int x = 1; double y = 2.5; std::string z = "result"; debug = "Results:", x, y, z; The above example outputs:
2
2289
by: benben | last post by:
I am looking for a good example of overloading operator , (operator comma) Any suggestions? Ben
3
1872
by: SteelDetailer | last post by:
Thnaks in advance for considering this post. It's probably very simple, but..... I have an old VB6 application that allows me to create, save and edit a "project information file" that is a simple .txt file. I then use that file to keep the project information current for the multiple AutoCAD drawings that project requires. My problem.....several of the items I save are company names (customers). Many times company names have commas...
11
2387
by: Shawn Odekirk | last post by:
Some code I have inherited contains a macro like the following: #define setState(state, newstate) \ (state >= newstate) ? \ (fprintf(stderr, "Illegal state\n"), TRUE) : \ (state = newstate, FALSE) This macro is called like this: setState(state, ST_Used);
4
2197
by: G Patel | last post by:
Hi, I've read a book on C, and I understand how comma operators work, but my book didn't say that the comma operators between function arguments were not really comma operators (even though it seems obvious to me that comma operators would serve no purpose between function arguments). As per C, are those commas in function argument lists the same comma operators? Also, are the =s used in initializations the same as any other
21
3030
by: siliconwafer | last post by:
Hi, In case of following expression: c = a && --b; if a is 0,b is not evaluated and c directly becomes 0. Does this mean that && operator is given a higher precedence over '--'operator? as opposed to what is mentioned in precedence table? Also, with comma operator. consider,
7
12616
by: MattyWix | last post by:
Hi, How can I pass a semicolon or a comma as a macro argument. I wish to build an expression that in some cases has a comma - eg building a list of members for a structure, but in other instances has a comma - eg building a list of arguments for a function. MattyWix
15
2624
by: Lighter | last post by:
In 5.3.3.4 of the standard, the standard provides that "The lvalue-to- rvalue(4.1), array-to-pointer(4.2),and function-to-pointer(4.3) standard conversions are not applied to the operand of sizeof." I think this rule is easy to understand. Because I can find the contexts of applying the rule as follows. (1) int* p = 0; int b1 = sizeof(*p); // OK, b1 = 4, *p would not be evaluated.
6
3145
by: lazukars | last post by:
Hi, I am attempting an ajax request. I am using PHP serverside. Below is what the response text should be. ajaxRequest.responseText ="{username_is_taken : "This username has been taken",}" However, the only way I can get the responseText to work on a website via an alert is to take out the comma before the curly bracket. By taking out I mean just not printing the comma with the rest of the string in PHP. If I take out this comma...
0
9155
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8858
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.