473,750 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting to excel and column data with carriage returns

I'm using the following function (I'm displaying the guts of it only) to
convert a datatable to an excel spreadsheet:

For Each mrow In dt.Rows
rowindex += 1

colindex = 0

For Each col In dt.Columns

colindex += 1

objws.Cells(row index, colindex) = mrow(col.Column Name).ToString( )

Next

Next

It works fine; however, when I convert columns with carriage returns in
them, the row does not wrap inside Excel; instead, you end up with a very
long (verticle) column. Inside Excel, even columns/autofit selection has
not effect. The entire spreadsheet, therefore, looks distorted. Is there
any way to strip out chr(10) + chr(13) from the data?

Thanks for any help.

Bernie Yaeger


Nov 20 '05 #1
4 1283
Cor
Hi Bernie,

When you look down about 20 rows in this newgroup you see a question from
Able almost like this,

I found it funny because a lot of people where answering on that.

Armin gives as extra the answer you need complete. (with the vbcrlf)
(I would take that one, mine was just a completely alternative method from
the earlier posters and I posted the same time as Armin)

If you cannot find it, I can give you of course the answer, but there are so
much possibilities in this message and answers.

By the way, if it is than still not working have than also a look at the
"HT" "09" and "Lf" "13" because as far as I remember me, Cindy once told in
this newsgroup that that was used with Excel.

I hope this works.

Cor
Nov 20 '05 #2
Hi Cor,

I've looked 60 down and in different sort orders but can find no other
question like mine. Can you give me some more info on that message?

Tx,

Bernie

"Cor" <no*@non.com> wrote in message
news:ek******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi Bernie,

When you look down about 20 rows in this newgroup you see a question from
Able almost like this,

I found it funny because a lot of people where answering on that.

Armin gives as extra the answer you need complete. (with the vbcrlf)
(I would take that one, mine was just a completely alternative method from
the earlier posters and I posted the same time as Armin)

If you cannot find it, I can give you of course the answer, but there are so much possibilities in this message and answers.

By the way, if it is than still not working have than also a look at the
"HT" "09" and "Lf" "13" because as far as I remember me, Cindy once told in this newsgroup that that was used with Excel.

I hope this works.

Cor

Nov 20 '05 #3
Cor
Hi Bernie,

Here is the link on Google, saves time

http://www.google.com/gr************* *************** **@news2.e.nsc. no

If it is not what you ment, tell me, but I am almost sure of it.

Cor
Nov 20 '05 #4
Hi Cor,

Yes, that is exactly what I needed! Tx.

Bernie

"Cor" <no*@non.com> wrote in message
news:eu******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi Bernie,

Here is the link on Google, saves time

http://www.google.com/gr************* *************** **@news2.e.nsc. no

If it is not what you ment, tell me, but I am almost sure of it.

Cor

Nov 20 '05 #5

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

Similar topics

13
35559
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
3
20283
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet (MyXL). It uses the worksheet's Application property to make Microsoft Excel visible, to close it, and so on. Using two API calls, the DetectExcel Sub procedure looks for Microsoft Excel, and if it is running, enters it in the Running Object Table. The...
1
2425
by: st | last post by:
Hi, I've a routine that exports a DB query to Excel by building an XmlDocument and saving to a XmlTextWriter. I'm having trouble with carriage returns in a mailing address not showing up in the final Excel sheet. What's added to the InnerText of an XmlDocument is something similar to:
5
8956
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column headers). I used ODBC in my VB.NET program to read that spreadsheet into a dataset, to make it easy to manipulate. The code I use to read it is as the bottom of this posting.
0
1680
by: Bryan Ax | last post by:
I'm trying to fix a bug in someone else's code. He's got a string saved in a database such as: <xsl:variable name="Var1"> <xsl:choose> <xsl:when test="@SomeAttribute &gt; 1'"> <xsl:value-of select="'Y'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'N'"/>
3
4117
by: JohnM | last post by:
I can transfer from a query with DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Filenam", CPath, True I would like to use a form for the user to select and order data then export th result. How do I set about this?
21
2022
by: py_genetic | last post by:
Hello, I'm importing large text files of data using csv. I would like to add some more auto sensing abilities. I'm considing sampling the data file and doing some fuzzy logic scoring on the attributes (colls in a data base/ csv file, eg. height weight income etc.) to determine the most efficient 'type' to convert the attribute coll into for further processing and efficient storage... Example row from sampled file data: , ....]
1
1986
by: =?Utf-8?B?Sm9XaWxsbW90dA==?= | last post by:
I have data that I would like to store in an excel spreadsheet. It's currently in a Word table. The problem is that each line has some cells that split over several lines. If I copy and paste it as is, the data split over lines get put into separate rows. I have partly solved this problem by replacing the paragraph mark (^p) in Word with a tilde (~). Now the rows are as I want them. But I want to replace the tilde in Excel 2008 with a...
1
10715
by: jollyroger | last post by:
I have searched the web forums, and can't seem to find an answer to this particular problem I have. In an excel sheet, cells in one column have formatted text in the "wrapped" cells. For many of the cells it is far more than 256 char. After import to Access, the carriage return (CR) and Line Feed (LF) is shown with a square symbol in the text, and the text is just "dumped" into the field without CR or LF. Have also tried to indentify the...
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
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...
0
9256
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
8260
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
6803
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
6080
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
4712
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...
3
2223
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.