Make text into table

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Make text into table

Unread post by Tobias Escher »

Hi!

I have several thousand (yes, I am not exaggerating) lines of text, looking like this:

Feature 1
Feature 2
Feature 3
and so on...

These lines are in a txt file, so I have them with "one feature per line"

Now I need to build a table with two columns

Column 1: Feature
Column 2: Description

So basically what I need is a way to with one click select each block of text, create a table with 2 columns and put the text in the 1st column, one line per row. Is this possible? It seems like a nightmare to do it manually.

best

Tobias
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Hi Tobias,

What sort of table do you want? An HTML file? An H&M topic XML file? Something else?

I have a Windows executable utility which does similar, creating tables from text. I can modify and post it if you wish? Note that it would be unsigned, so your employer may not allow it to be used.

regards,

Martin.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Make text into table

Unread post by Tobias Escher »

Hi!

I need a table in H+M - in a perfect world I could just select a block of text and it would create a table of it with each line being in 1 cell.
If you appliation could do something similar, I would be very interested. Unsigned is no problem; I can use it on my personal laptop.

best

Tobias
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Make text into table

Unread post by Tobias Escher »

PS:
The screenshot shows how it looks (top) and how it should look after creating the table (bottom).
Currently I seem to need to create a table with the number of rows and 2 columns and then manually copy and paste each line into the table. When I select the whole text block and copy and paste it into the table, it is pasted into a single cell. It should be 1 cell per line (as for example Excel does it when copying and pasting).
You do not have the required permissions to view the files attached to this post.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Hi Tobias,

What output format do you want from H&M?

For Webhelp, CHM, EWriter, the easiest solution is to create an HTML file and insert it in your topic as an HTML Code Object. Which is what I do.

For PDF, printed output, etc., that won't work, it would need to be an XML topic file. Which is doable and more flexible for any final editing or future updating, but more work.

How do you want the text aligned in the left-hand cell? Horizontal left, right, or centred? Vertical top, middle, or bottom? Any formatting requirements for the text? Bold, italic, larger font, colours, etc.?

e.g. 01. Bass Drum 28" Singles & Rolls

Any background colours for the columns or rows? Any specific requirements for padding, cell borders and spacing, etc.?

regards,

Martin.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Make text into table

Unread post by Tobias Escher »

Hi Martin,

output formats will be WebHelp, ePub, PDF and Word.

Basically this about very long lists of file names. I just made a count and it will be about 3000 at the end.
So 3000 items, one line each like for example:

Kornmesser Guitar R
01. Guitar Right Power Chords
02. Guitar Right Alternative Power Chords
02. Guitar Right Double Power Chords
03. Guitar Right Alternative Power Chords
03. Guitar Right Double Power Chords
04. Guitar Right Single Strokes
05. Guitar Right Tremolo
06. Guitar Right Tremolo Muted

Troppauer Bass
01. E-Bass Single Strokes
02. E-Bass Shorts

Gardeschützen Drumset
01. Drumset

these will be three tables.
The first line of each block is a heading and will stay.
All other lines of each block are one row each. The table needs 2 columns (possibly more, but for now 2 are enough).
What I want to do is find an automatic way (in H+M) of creating these tables and putting in the text that is already in H+M with one line per row in the table.

No formatting whatsoever needed (if any will be needed later on it will be 1 format per column).

EDIT: I do not want external files, or rather I do not need them. The text is already in H+M, everything is done. Just the tables are missing.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Tobias Escher wrote:output formats will be WebHelp, ePub, PDF and Word.
Hi Tobias,

OK, that means HTML is no go, it will have to be RVF or XML.
Basically this about very long lists of file names.
Those are not file names with spaces in them. :?
They won't work with spaces in Webhelp. I can change the spaces to underscores if necessary?
I do not want external files, or rather I do not need them. The text is already in H+M, everything is done. Just the tables are missing.
OK, I understand. You will need to copy and paste the text into my executable, create the table, and paste it back. I will look at doing that in RVF. If not it will be a separate XML topic, from which you would need to copy and paste back into the original topic.

Give me me an hour or two to modify my existing code to suit. I needed an excuse not to mow the lawn. :)

regards,

Martin.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Make text into table

Unread post by Tobias Escher »

Awesome, Martin!

Those actually ARE file names. But it does not matter, it is just text that is already in H+M.
In excel making this a table would take 1 second because when you copy and paste multiline text there it will use 1 cell per line.
H+M uses 1 cell per text.
So the actual "fix" would be that if the user pastes multiline text in H+M, the software should use 1 cell per line, not fit the whople text in one cell.

Just so we are on the same page:

Right now I have a text block
a
b
c

and it needs to become a table with two columns, three rows. The first column has a in the first row, b in the second and c in the third.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Tobias Escher wrote:So the actual "fix" would be that if the user pastes multiline text in H+M, the software should use 1 cell per line, not fit the whole text in one cell.

Just so we are on the same page:

Right now I have a text block
a
b
c

and it needs to become a table with two columns, three rows. The first column has a in the first row, b in the second and c in the third.
Hi Tobias,

Yes, I understand that. But just to be clear, I am not creating a "fix" for H&M, I'm not connected in any way with EC Software, other than being a happy user. This would be an entirely separate 3rd party utility program.

regards,

Martin.
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: Make text into table

Unread post by Simon Dismore »

Tobias Escher wrote:it is just text that is already in H+M.
In excel making this a table would take 1 second because when you copy and paste multiline text there it will use 1 cell per line.
If you have Excel, you can use it to do the job by following these steps:
  1. Backup your H&M file for safety
  2. Start Excel and have an empty spreadsheet open
  3. Select (i.e. highlight) your rows of text in H&M
  4. <Ctrl>+<c> to copy it to the clipboard
  5. Paste into cell A1 of your spreadsheet
  6. Paste again into cell B1
    This is a quick way to ensure there's dummy data in the second column (if you are using another spreadsheet the dummy data might not be necessary)
  7. Select the cells in Excel
    A quick shortcut is to click on A1 and then press <Ctrl>+<Shift>+<End>
  8. <Ctrl>+<c> to copy it to the clipboard
  9. Paste it back into H&M
    The pasted data will be in a two-column table
  10. Use table properties to adjust the table width if necessary
    If you have dummy data to get rid of:
  11. Select (highlight) the second column in H&M
    You can do this quickly by hovering over the top border until a black down arrow is displayed, and then clicking your mouse
  12. Press <Delete>
    The dummy data will be blanked but the cells will remain
I tested this with 300 rows and it took less than a minute :). When you are ready to start entering real data in the second column you might find it easier to maintain it in Excel and copy it across every time it changes.
Last edited by Simon Dismore on Fri May 13, 2016 6:04 pm, edited 2 times in total.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Many thanks Simon.

That also works in OpenOffice Calc, although I would never have thought of trying it. :)

There is no need for dummy data in the second column. I don't use Excel.

Tobias, I shall continue with what I was doing for my own interest, but I don't think you will need it now.

regards,

Martin.
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: Make text into table

Unread post by Simon Dismore »

Martin Wynne wrote:I would never have thought of trying it. :)
Same here! I'd got my own complicated H&M4-era routines for building H&M tables in XML. But then it occurred to me that version 7 added a lot of improvements to H&M's pasting-from-other-apps capability, so I thought I would have a quick look. Actually, it turns out the same steps work in H&M6 too. Lesson learned. I've updated the steps to say that the dummy data might not be necessary.

Have a good weekend,
Simon
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Simon Dismore wrote:Actually, it turns out the same steps work in H&M6 too.
Hi Simon,

It turns out that it works in the TRichView editor from way back. Which means it has been working in H&M from HM4 onwards. :)

I have a TRichView editor in my own application (creating metafile images), so I'm now off to update the Help for that. It's a much easier way to create tables than pasting or importing RTF from Word.

Many thanks again for finding this.

regards,

Martin.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Hi Tobias,

You can also get what you want via Microsoft Word. Copy and paste your text there, then use the Convert Text to Table function. Using your text would create a single column table. After copying and pasting that table back to H&M, you can easily add additional columns as required.

In my ancient copy of Microsoft Word, that's at Table > Convert > Text to Table... menu item.

regards,

Martin.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Make text into table

Unread post by Martin Wynne »

Hi Tobias,

In your reply on the Wish List you mention the need to create hundreds of tables. This is the first time you have mentioned this, previously I assumed you were creating a single table, or a small number of tables.

At present there is no way to do this conversion process without some form of copying and pasting to and fro. However I can modify my utility to create a fresh table, say for each blank line in the text. You could then create multiple tables to be pasted in one go. Whether it would be wise to have hundreds of tables in a single topic is for you to decide.

regards,

Martin.
Post Reply