Ask Your Question
1

Problem with converting a text document to a table

asked 2021-01-09 12:14:58 +0100

EricLibreOffice1253 gravatar image

updated 2021-01-09 20:44:12 +0100

ajlittoz gravatar image

When I convert a text document to a table (with 2 columns), there is a large space before the text in the right hand column. The text doesn't align to the left of the column like it should. Can anyone tell me how to fix this problem so that the text aligns correctly to the left of the column?

C:\fakepath\Screenshot - Convert Text to Table problem2.png

C:\fakepath\Screenshot - Convert Text to Table problem1.png

(ajlittoz is tired to fix the non usage of the "slide" tool instead of the "upload" tool)

edit retag flag offensive close merge delete

Comments

2

Share a sample file. Screenshots are useless.

gabix gravatar imagegabix ( 2021-01-09 13:02:25 +0100 )edit

What happened to the semi-colons? Were they used as separators for conversion to Table, if that is the case then what happened to the existing tab stops? Are they inside the table now?

With the text layout I see I would have thought that selecting your list, then clicking Table > Convert > Text to Table and under Separate Text At selecting Tabs would be the normal way, but maybe you wanted to remove the semi-colons at the end bit not within the text?

Earnest Al gravatar imageEarnest Al ( 2021-01-10 01:24:06 +0100 )edit

4 Answers

Sort by » oldest newest most voted
1

answered 2021-01-09 17:29:28 +0100

floris v gravatar image

When you are editing or still writing your text, make sure that View - Formatting Marks (Ctrl+F10) is enabled. That way you can see spaces, paragraph marks, tab stops and much more. It's an essential tool for solving problems like the one you have. Without it, it's just about impossible to say what went wrong here, there are several possible causes.

edit flag offensive delete link more
0

answered 2021-01-10 15:11:59 +0100

EricLibreOffice1253 gravatar image

updated 2021-01-10 20:31:56 +0100

ajlittoz gravatar image

C:\fakepath\Screenshot - Convert Text to Table problem5.png

C:\fakepath\Screenshot - Convert Text to Table problem6.png

C:\fakepath(new9f) Hmong Vocabulary List, Eng-Hmg, Appendix, semi-colons set differently.docx

C:\fakepath(new9f) Hmong Vocabulary List, Eng-Hmg, Appendix, table after semi-colons set differently.docx

Thanks to everyone for their replies and suggestions (especially Foris V). I checked the documents with the Formatting Marks added, which showed the tabs. I redid the original document, using tabbing to set the semicolon right before where I wanted the right column to start, (instead of setting the semicolons after the end of the words in the left column and tabbing to where I wanted the right column to begin). Then, when I converted it to a table, it came out correct, with the words in the right column all the way to the left of that column. This does work, but I don't like having the semicolon right before the first word in the right column. (I'm converting this to a table so that I can reverse the 2 columns by cutting and pasting, resulting in 2 vocabulary lists, one English to Hmong, and the other Hmong to English, so I will be using the original document.) When I did this in Microsoft Word on another document a few years ago, I think I just set the semicolon at the end of the words in the left column. I’ll attach screenshots and sample files.

In response to Earnest Al - Yes, I was using semi-colons as seperator markers to indicate where to divide each line into 2 columns. I tried setting the separator as tabs, but it created a document with many columns, whereas I only wanted 2 columns.

(edited by ajlittoz - once again: the upload tool is not the same as the slide tool, though they are based on the same device)

edit flag offensive delete link more

Comments

1

This is not a solution to your question but rather a comment (thanks are really appreciated) but it would have been better in a comment.

Your multiple use of tabs is faulty. A single tab is just enough. To align you need only to define it in the paragraph style.

You are using Default Paragraph Style* everywhere. This is faulty because this style defines defaults for all others. The "normal" style for text is Text Body.

Working with Writer implies you should save as .odt. Saving as .odx ".docx" will cause repeatedly compatibility issues at load and save times. Always save in native format otherwise this ruins carefully crafted formatting.

Learn to work with styles.

ajlittoz gravatar imageajlittoz ( 2021-01-10 20:39:34 +0100 )edit

will cause repeatedly compatibility issues at load and save times

Moreover, it poses a very high risk of losing your work completely.

gabix gravatar imagegabix ( 2021-01-11 05:31:10 +0100 )edit

Thanks for the new suggestions. There are 12 tabs that are set automatically when I open a page. I'm unable to change that. I spent about 30 minutes today trying to understand the "Inserting and Editing Tab Stops" page at help.libreoffice.org, but was unable to set the page to just 1 tab. The instructions for deleting a tab say "To delete a tab, hold down the mouse button while you drag the tab outside the ruler." That didn't work. I tried dragging the tab stops in the ruler in different directions - up, sideways, down - but the tab wouldn't delete. I also tried setting the tabs via right click > paragraph > edit style > tabs, but was unable to reset the tabs. Regarding the suggestion to work with the document in the odf format and to use the Text Body paragraph style - I tried both ...(more)

EricLibreOffice1253 gravatar imageEricLibreOffice1253 ( 2021-01-12 08:59:09 +0100 )edit

Edit: I am now able to set a page to have a single tab on a new document by dragging the tab stop in the ruler to the right. However, I am unable to reset the tabs to a single tab on the document that I've already typed.

EricLibreOffice1253 gravatar imageEricLibreOffice1253 ( 2021-01-12 09:12:43 +0100 )edit
1

In the ruler, you see two kinds of tabs. The bold ones are those you set explicitly. The thin ones (normally at right after the last explicit one) are implicit evenly spaced according to Tools>Options, LibreOffice Writer>General, Tab stops option. The implicit ones cannot be removed.

The best way to handle the tab stops is through paragraph styles. This guarantees consistency across paragraphs which should be formatted identically.

All the buttons, rulers, keyboard shortcuts, … are provided for quick'n'dirty job or for mechanical typewriter nostalgia. LO Writer is based on styles. Read the Writer Guide to discover the various styles and practice to get accustomed to their power and versatility.

ajlittoz gravatar imageajlittoz ( 2021-01-12 09:29:53 +0100 )edit

By playing around with the tab stops in the ruler, I was able to set just one stop on the document (at least on the left side where I wanted it). By dragging the tab stops to the right, I was able to set an explicit stop in the middle of the page, and the implicit stops to the left of that were dragged away. However, I now find that setting just one tab stop (as was suggested by Ajlittoz) does not solve my problem. When I convert the text to a table, I still have gaps in front of the words in the right column that come from the single tab that was set. I would post screenshots and sample files, but it seems that I am unable to do that in a comment. By the way, to Ajlittoz - I don't understand your note that "the upload tool ...(more)

EricLibreOffice1253 gravatar imageEricLibreOffice1253 ( 2021-01-14 07:10:24 +0100 )edit

The upload tool is accessed through the paperclip icon. Images are inserted in the question with the slide icon. Both end up in storing a file in the site database (this is what I mean with "same device").

To post screenshots and sample files, edit your question. Scroll to the end. Type Enter twice at least to separate them. Add a descriptive note. Use the tools to upload the images/files.

ajlittoz gravatar imageajlittoz ( 2021-01-14 08:18:22 +0100 )edit
0

answered 2021-01-12 14:59:17 +0100

LeroyG gravatar image

@EricLibreOffice1253, Before converting the text to table, find all multiple tabs instances (\t+) and replace with a single tab (\t); needs to check Regular expressions. You will see the data a bit messy, meanwhile.

Starting off from your first screenshot, you can find all multiple tabs instances (\t+), and replace with none.

Tested with LibreOffice 6.4.7.2 (x64); OS: Windows 10.0.


Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

If the answer helped you, you can mark the up arrow (Upvote mark) that is on the left (to vote, you need to have karma of at least 5).

edit flag offensive delete link more
0

answered 2021-01-12 09:22:27 +0100

gabix gravatar image

Posting as an answer to this comment:

I am unable to reset the tabs to a single tab

Here is a macro from Andrew Pitonyak's Useful Macro Information for OpenOffice.org to remove empty space, including squeezing multiple tabs to a single one:

Function IsAnythingSelected(oDoc As Object) As Boolean
  Dim oSels  'All of the selections
  Dim oSel         'A single selection
  Dim oCursor      'A temporary cursor

  IsAnythingSelected = False
  If IsNull(oDoc) Then Exit Function
  ' The current selection in the current controller. 
  'If there is no current controller, it returns NULL.
  oSels = oDoc.getCurrentSelection()
  If IsNull(oSels) Then Exit Function

  REM I have never seen a selection count of zero
  If oSels.getCount() = 0 Then Exit Function

  REM If there are multiple selections, then certainly 
  REM something is selected
  If oSels.getCount() > 1 Then 
    IsAnythingSelected = True
  Else
    REM If only one thing is selected, however, then check to see 
    REM if the selection is collapsed. In other words, see if the 
    REM end location is the same as the starting location.
    REM Notice that I use the text object from the selection object
    REM because it is safer than assuming that it is the same as the
    REM documents text object.
    oSel = oSels.getByIndex(0)
    oCursor = oSel.getText().CreateTextCursorByRange(oSel)
    If Not oCursor.IsCollapsed() Then IsAnythingSelected = True
  End If
End Function

Function GetLeftMostCursor(oSel As Object) As Object
  Dim oRange   'Left most range.
  Dim oCursor  'Cursor at the left most range.

  If oSel.getText().compareRegionStarts(oSel.getEnd(), oSel) >= 0 Then
    oRange = oSel.getEnd()
  Else
    oRange = oSel.getStart()
  End If
  oCursor = oSel.getText().CreateTextCursorByRange(oRange)
  oCursor.goRight(0, False)
  GetLeftMostCursor = oCursor
End Function

Function GetRightMostCursor(oSel As Object) As Object
  Dim oRange   'Right most range.
  Dim oCursor  'Cursor at the right most range.

  If oSel.getText().compareRegionStarts(oSel.getEnd(), oSel) >= 0 Then
    oRange = oSel.getStart()
  Else
    oRange = oSel.getEnd()
  End If
  oCursor = oSel.getText().CreateTextCursorByRange(oRange)
  oCursor.goLeft(0, False)
  GetRightMostCursor = oCursor
End Function

Function CreateSelectedTextIterator(oDoc As Object, sPrompt As String, oCurs()) As Boolean
  Dim lSelCount As Long       'Number of selected sections.
  Dim lWhichSelection As Long 'Current selection item.

  Dim oSels  'All of the selections
  Dim oSel         'A single selection.
  Dim oLCurs     'Cursor to the left of the current selection.
  Dim oRCurs     'Cursor to the right of the current selection.

  CreateSelectedTextIterator = True
  If Not IsAnythingSelected(ThisComponent) Then
    Dim i%
    i% = MsgBox("No text selected!" + Chr(13) + sPrompt, _
      1 OR 32 OR 256, "Warning")
    If i% = 1 Then
      oLCurs = oDoc.getText().createTextCursor()
      oLCurs.gotoStart(False)
      oRCurs = oDoc.getText().createTextCursor()
      oRCurs.gotoEnd(False)
      oCurs = DimArray(0, 1)
      oCurs(0, 0) = oLCurs
      oCurs(0, 1) = oRCurs
    Else
      oCurs = DimArray()
      CreateSelectedTextIterator = False
    End If
  Else
    oSels = ThisComponent.getCurrentSelection()
    lSelCount = oSels.getCount()
    oCurs = DimArray(lSelCount - 1, 1)
    For lWhichSelection = 0 To lSelCount - 1
      oSel = oSels.getByIndex(lWhichSelection)
      REM If I want to know if NO text is selected, I could
      REM do the following:
      REM oLCurs = oSel.getText().CreateTextCursorByRange(oSel)
      REM If oLCurs.isCollapsed() Then ...
      oLCurs = GetLeftMostCursor(oSel)
      oRCurs = GetRightMostCursor(oSel ...
(more)
edit flag offensive delete link more

Comments

Well, I read through that, but I don't understand it. I speak 4 languages, but not that one. :)

EricLibreOffice1253 gravatar imageEricLibreOffice1253 ( 2021-01-12 12:47:05 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-01-09 12:14:58 +0100

Seen: 77 times

Last updated: Jan 12