Color-formatted into RTF

[expired user #7579]'s profile image [expired user #7579] posted 10 years ago in General Permalink
Hi

I am learning MySQL and save what I was taught into RTF
RICH TEXT Formatted files.

I would like to enter the code into Heidisql its
Query-control.
Then, mark it as color-formatted as HEIDISQL
formats rge text for me and past it the same
color-coded as HEIDISQL shows me the script
into RTF-files.

However, the text it pasted as black text as
'normal' text.

Next to SQL with eg SELECT * FROM people,
I also would like to have that with e.g.
creating Database and Tavkes,

See the code below.
Inside the Edit-control of HEIDISQL it is
color-coded. I want this too to be copied and pasted
color-coded into RTF. Thanks in advance.

CREATE DATABASE swingtest;

USE swingtest;

CREATE TABLE people (
id SMALLINT NOT NULL AUTO_INCREMENT,
name varchar(45) NOT NULL,
age enum('child','adult','senior') NOT NULL,
employment_status varchar(45) NOT NULL,
tax_id varchar(45) NULL ,
us_citizen bool NOT NULL,
gender enum('male','female') NOT NULL,
occupation varchar(45),
PRIMARY KEY (id)
);

DESCRIBE people;
justpusher's profile image justpusher posted 10 years ago Permalink
Excuse me... Why do you need colored code in RTF?

I don't know if this is possible in HeidiSQL, but you can copy-paste SQL code to any online code colorizer (e.g. http://hilite.me/ ) and then copy-paste to your RTF editor.
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink
What do you use to edit rtf file ?

I think copy/paste is working only with Microsoft Office.

But it's possible to export to rtf file.

I will see that.
kalvaro's profile image kalvaro posted 10 years ago Permalink
It's actually a pretty good feature request. It's technically possible to copy clipboard contents in several formats, including plain text and formatted text, and the target application where you paste the clipboard can choose a format it supports. It's handy when you need to send some SQL through e-mail or you're writing documentation in a word processor.

Of course, it can get on your way when you don't want syntax highlighting and that's something to take into account. And I imagine that copying huge buffers can eat a lot of memory. So it'd be worth some further analysis.
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink
I Checked source code and there is already functionality to copy formatted text as HTML that's why it's working to Microsoft office.

I'll try to see how it could be work into rtf editor.
kalvaro's profile image kalvaro posted 10 years ago Permalink
Adrien, you're absolutely right, the HTML feature already exists since May 2010. I had completely forgotten it.
[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
Thanks.

Could you tell me how to use it?

Regards
kalvaro's profile image kalvaro posted 10 years ago Permalink
What currently exists is the feature to copy as HTML, not RTF as you request. If your word processor supports HTML, it happens automatically when pasting.
[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
OK,

Thank you.
Will try OpenOffice tomorrow.

But, as someone having programmed with Delphi 7,
I wonder, could the developer not use the RTF-CPOMPONENT
I found at Torry (I think it was an add-up for the
RXRichEdit and JEDIRTX-control) with which the text could be
encoded as SQL, JAVA, PASCAL instead of the SYNEDIT?

Thanks
jfalch's profile image jfalch posted 10 years ago Permalink
of course. exchange a major core component of the program, days, possibly weeks of work, with the result to be able to do what exactly that did not work before ?
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink
Why see another component ?

With Synedit you can export to html or rtf.

I think the better solution is to find how to copy into the clipboard with synedit export (rtf/html) for this to work for many editor
[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
I use
-- EditorDemo, the compiled exe-bin file of the JRichText-component
-- ActionTwxtUni, the exe-bin file of thw RichView package
-- TrwwDBNotes, the freeware version which also uses the
the RichView-package, I thing the DBAware-version

I would like to past in esp into the last one as color-coded
rtf-text.

Could you work on this?

Thanks and Regards
jfalch's profile image jfalch posted 10 years ago Permalink
make a feature request.
[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
You must know

http://heidisql.googlecode.com/svn-history/r2/components/SynEdit1.1/Demos/ExportDemo/frmExportMain.pas

[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
Feature request:

You could either add Tbuttons under the Query-control:
Captions: Copy as plain Text
Copy as RichText
Copy as HTML
or add a TPopupmenu to the uery-control being a TSynEdit
with three popupmnu-items with the sane captions.

Look, I know I kewp on bothering you, but I really want to
keep on using HeidiSQL with the two tutorials I follow:
MySQL
Java Swing with JDBC-MySQL
each with creating database, tables and Fields and actual data
and using SQL we know.

What bothers me: later on, the multible-table queries are
explained with JOIN. For that, I could do with a Visual
Query Builder. I could use MySQL Workbench but would have
to go to and through between Workbench and HeidiSQL to get
the SQL as RTF or maybe HTML.

Thanks and Regards
Schon mal herzlichen Dank fuer deine Muehe!
jfalch's profile image jfalch posted 10 years ago Permalink
a feature request does not mean prefixing your posts her with "feature request". it means logging in to http://code.google.com/p/heidisql/issues and creating a new entry there.

Visual Query Bulider is not going to happen; much too complicated, and there exist alternativ solutions (eg Mysql Workbench)
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink
I sent a patch to Ansgar.

I wait his answer, if he's ok, i will submit the modification and it will work for all rtf editor / word processor that can read rtf from clipboard.
Code modification/commit from adri.granger@gmail.com, 10 years ago, revision 8.3.0.4699
Copy Paste SQL code keep highlight text for more rtf editor. See http://www.heidisql.com/forum.php?t=14736#p14776
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink
OK It's done in r4699.
You keep now highlight text when you past on rtf editor
[expired user #7579]'s profile image [expired user #7579] posted 10 years ago Permalink
Thanks, great!
Now I can continue with my both tutorials.

De: Richtig toll, Danke dir fuer die Muehe!
fbachofner's profile image fbachofner posted 10 years ago Permalink
Thanks for the new feature adrien. This is cool, but SQL is, realistically, plain text.

The simple (and arguably appropriate) solution for Philips10 would have been to paste the SQL code into a TEXT EDITOR which colorizes based on syntax.

Take a look at Notepad++, for example ( http://notepad-plus-plus.org/ )

Any file will be analyzed for the programming language it uses and colored accordingly. Such syntax highlighting is so important in a programmer's editor, it is usually listed as one of the first features! http://notepad-plus-plus.org/features/

SQL is, of course, one of the syntaxes it understands.
kalvaro's profile image kalvaro posted 10 years ago Permalink

Thanks for the new feature adrien. This is cool, but SQL is, realistically, plain text.

The simple (and arguably appropriate) solution for Philips10 would have been to paste the SQL code into a TEXT EDITOR which colorizes based on syntax.



There's some confusion here. The feature is not strictly new, it's been here for more than 3 years. The r4699 recent change only switches one of the internal clipboard formats from HTML to Rich Text. We could discuss whether HTML should be kept as well but nobody's going to remove a well established feature that's practical for those who need it and unobtrusive for those who don't.

Notepad++ is a text editor, not a word processor. Its syntax highlighting isn't saved in the output file.
fbachofner's profile image fbachofner posted 10 years ago Permalink
Hi Kalvaro:

I know Notepad++ doesn't save the syntax highlighting in any outputted file. Thank God. That's the point! SQL is plaintext and Notepad++ deals with plaintext files.

The point I was trying to make is that if you need to see (or print) with syntax highlighting outside of HeidiSQL, then put the SQL in a programmer's editor.

The only use case I can see for RTF or HTML output for SQL might be to create help files or other documentation.

On that note, if I copy SQL statements from HeidiSQL (where the syntax highlighting is working) and paste into LibreOffice Writer (using edit/paste special/html format) I get no syntax highlighting. (HeidiSQL 8.3 r4698) Seems like the "old" feature is broken -- I'll try newest rev and report back.
[expired user #7662]'s profile image [expired user #7662] posted 10 years ago Permalink

What do you use to edit rtf file ?

I think copy/paste is working only with Microsoft Office.

But it's possible to export to rtf file.

I will see that.



It's what I said before r4699
Now it's work with openoffice and libreoffice
fbachofner's profile image fbachofner posted 10 years ago Permalink
Adrien and Kalvaro:


Yes, confirmed: in r4701 copied SQL code pasted into LibreOffice comes across with syntax highlighting.

However, HTML format is no longer one of the edit/paste special clipboard options. Now it is only RTF. Was that intended?

Please login to leave a reply, or register at first.