Toad World® Forums

Export Dataset - HTML Table strips CHR(10)


#1

I am trying to “Export Dataset” with the Export format of “HTML Table”. The data that I am trying to export contains CHR(13)||CHR(10) and also contains just CHR(10).

What is happening is that the export is stripping out this data.

Is there some option to include the CHR(10) in the data? Or is there something that I can add to my data to force the HTML to have the CHR(10)?

Thanks,
David

p.s. If I select to export as delimited text, the CHR(10)s are coming across.


#2

Check Options -> Oracle -> General.
On the right, at the top…is “Newline format” set to Unix? If so, set it to “windows”.

This option is mislabeled. The “Windows” setting does not change newline data. The “Unix” setting converts data to Windows when you select it, and converts to Unix when you insert/update it. The option has been relabeled for the next version.


#3

When I do an HTML export, it is still strips the CHR(13)||CHR(10) out of the HTML. Below is an example. See how the CHR(13)||CHR(10) got converted into a SPACE?

select ‘A’||CHR(13)||CHR(10)||‘B’ TEXT_TX from dual


#4

What version of Toad are you using?

This was my test in 12.12:

create table html_test
(description varchar2(30),
 data varchar2(30));
 
insert into html_test
(description, data)
values
('a 13 10 b', 'a' || CHR(13) || CHR(10) || 'b');

insert into html_test
(description, data)
values
('a 10 b', 'a' || CHR(10) || 'b');

commit;

I tried to paste the whole result here but it’s not staying unformatted. :frowning:

The first line had: a
b
The 2nd line had a
b


#5

Are you running your query in the Editor with F5? When I do that, the #13’s get stripped out for me. I don’t recommend exporting data from an F5 grid because the datatypes all get changed to string, and apparently the line feeds get messed up too.

Try with F9.


#6

I am using TOAD Version 13.1.0.61

Thanks,

David


#7

I press [Ctrl] Enter, which I believe is the same as pressing F9.

Thanks,

David


#8

Are you looking at the html code or viewing the result in a browser? In a browser, I see the line feeds appearing as a space. But the HTML code shows the encoded 
 and 
.


#9

That “export as html” code is really old. I’m not sure if the original intent was to render line feeds as line feeds, or try to preserve the data as much as possible with the 
 and 
 encodings.

I guess one could argue that the &#13; and &#10;'s are technically correct, but they since they render as spaces…maybe we ought to be converting them to <br>.

Thoughts?


#10

I exported the data to my clip board and then pasted it into “Outlook”. I reran the same test and pasted to “UltraEdit”, a text editor. I see the XML escape characters for ASCII 13 and 10. Doesn’t do anything in outlook as I believe it is expecting a
. (See below for the data that was in my clip board)

I then saved the doc as an HTML file and opened it in IE, and again it does not show the B on the next line, so at least Outlook is working the same as the Browswer.

So I can see that TOAD is accurately returning what is stored, but at the same time, it would be really nice if we could make the CHR(13)CHR(10) be returned with a
so that it was formatted the same as what we see in the grid.

Thanks,

David

'A'||CHR(13)||CHR(10)||'B'
A B

#11

I would love for them to be converted to
, but I could see where others would not. Can it be configurable, then it is the users choice.

Thanks,

David


#12

If your target is Outlook, an easy workaround might be just CTRL+C from the grid, then paste into outlook. Or use CTRL+Insert (which makes no sense, I know) if you want to include column headers.

thinking about the <br> substitution for line feeds…I’m afraid that doing that might just start down a rabbit hole, as there are other HTML formatting oddities, such as multiple spaces getting converted to single spaces, and I’m sure there are others.


#13

Doing that loses the table effect making the data difficult to read which doesn’t resolve the issue. Thanks for looking at it… I will just live with the export functionality (though I would really prefer a config option on the export).

Thanks,

David


#14

You can get the table effect like this:

After you paste the text into Outlook, select the text you just pasted. Go to the “Insert” ribbon. Click the “Table” icon, and then one of the menu items under it is “Convert Text to Table”. It pops up a dialog, I just take the defaults for it.

This is Outlook 2010. Hopefully your version is similar.


#15

by the way…whenever I pasted Toad’s HTML export format into Outlook, I just got the HTML code (not the rendering). What did you do to get the rendered table?


#16

Thank you, that is a really nice feature that I did not know existed. Unfortunately, when there is a line feed in the data it treats this as a new row instead of part of the previous row.

Thanks,

David


#17

I just exported HTML to clipboard, then pasted into Outlook. Outlook understands that it is HTML and provides the proper formatting. If you past this into notepad, then copy the HTML into Outlook it does not format it expected (You just see the text in Outlook). I have not figured out how to force Outlook to format it as HTML.

David