| View previous topic :: View next topic |
| Author |
Message |
hermtheworm Newbie

Joined: 10 Feb 2009 Posts: 3
|
Posted: Tue Feb 10, 2009 8:07 pm Post subject: just one weird question for you guys |
|
|
Ok guys, this is my first post, thus my first question.
I have a list of about 6000 items, in a ".csv" basically what i need to do is import it into rows like:
XXXX
XXXXX
XXX
XX
XXXXX
XXXX
but the problem is, i can only import it into columns and it maxes out at like 1025.
NEXT QUESTION (if the first one gets solved):
Once they are in rows. I need to add "<td>" in the front of each one, and "</td>" to the end. (html) And i have a BASIC understanding of the function wizard
End result should be:
<td>XXXX</td>
<td>XXXXX</td>
<td>XXX</td>
<td>XX</td>
<td>XXXXX</td>
<td>XXXX</td>
Any alternate way of doing this is appreciated.
THANKS IN ADVANCE! |
|
| Back to top |
|
 |
hermtheworm Newbie

Joined: 10 Feb 2009 Posts: 3
|
Posted: Tue Feb 10, 2009 8:26 pm Post subject: |
|
|
$10 paypal for the solution  |
|
| Back to top |
|
 |
tekenbarba General User

Joined: 26 Dec 2008 Posts: 46
|
Posted: Wed Feb 11, 2009 12:01 am Post subject: |
|
|
Must admit that I would write a Java program to parse the file for me and format it correctly and I am certain that it should be possible to create a Macro to open the CSV file, read as far as the first comma delimiter, extract the text, format it and insert it into a row then repeat.... However, this bit is beyond me at this point and I only hope someone with Villeroy's level of expertise will look at this post.
So, the brute force method would be to use a word processor to do a search and replace. Search for the comma delimiter and replace it with a string consisting of the closing table element tag, a carriage return character and the opening table element tag. All that should remain is to insert by hand the tags at the end of and start of the data string then to save the file again - under a new name to be safe. This should - should - refoprmat the file into one where each element is on a separate line. Now the tricky part is how to enter the carriage return character....... |
|
| Back to top |
|
 |
tekenbarba General User

Joined: 26 Dec 2008 Posts: 46
|
Posted: Wed Feb 11, 2009 12:47 am Post subject: |
|
|
| Just had a quick play with Word, and I found that if I did a search for the comma and used this - </td>^p<td> - as the replacement string then I ended up with a csv file where each item was on a separate line. All I had to do was add the opening table element tag to the first entry and the closing table element tag after the last entry. I am sure you should be able to do something similar with Writer - just need to determine what to use as the new paragraph - ^p - character. |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8984 Location: Lexinton, Kentucky, USA
|
Posted: Wed Feb 11, 2009 11:20 am Post subject: |
|
|
Similar to the above.
Change the file extension to .txt and open in Writer. Use Find & Replace to find commas, or other delimiter and replace with \n (a paragraph break) and check Regular Expressions. Change the extension back to .csv and open in Calc.
Use Find & Replace again. Search for .+
replace with <td>&</td>
and again check Regular Expressions. |
|
| Back to top |
|
 |
tekenbarba General User

Joined: 26 Dec 2008 Posts: 46
|
Posted: Thu Feb 12, 2009 12:01 am Post subject: |
|
|
| Just to add to JohnV's response, it can all be done in a single step. The search and replace for the delimiter can be combined into a single step I found; as JohnV suggested, check the Regular Expressions checkbox and use a replace string similar to this - </td>\n<td>. |
|
| Back to top |
|
 |
|