![]() |
|
#1
|
|||
|
|||
![]()
Hello everyone,
I want to convert this data, which is converted from pdf, in word into a table but I am not getting the lines connected to each date in one row. Is there any other way to separate the rows at each change in data and getting the full data of that date in one row.? There are more than 500 dates in the original document. I would really appreciate it if anyone can show me an easier way to do it in one go. Thank you in advance. |
#2
|
||||
|
||||
![]()
Since your data are in a Word table, all you need do is use the table tools to apply a border to each row. Simple as.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
![]()
Are you asking how to remove the leading or trailing the paragraph marks from the table cells? That would allow the dates to align with the tops of the other cells in each row.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
![]()
I tried inserting a table but the values of one date is getting mixed up with the adjacent dates. I tried inserting the border too I got the same result.
|
#5
|
||||
|
||||
![]()
It isn't clear what your problem is but I'm going to assume that you are finding the table rows are happening in the wrong places.
The easiest fix is going to be working on the conversion step from PDF. There are multiple ways to convert PDF depending on the applications you have at your disposal. Have you tried converting the PDF into Excel rather than Word? Or try some different methods of conversion?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#6
|
|||
|
|||
![]()
Yes. I tried to convert it to excel but I faced the same problem. I even tried notepad++ but that was also too far from good and needed a lot of cleaning.
|
#7
|
|||
|
|||
![]()
I have regularly been converting a lot of bank statements and customize them but a few bank statements just don't display the data in the required order. Hence, a lot of cleaning the excel sheet takes a lot of my time.
|
#8
|
|||
|
|||
![]()
Can anyone at least suggest how to insert a line at every line.
Or How do I remove the table and get the data without the table.? |
#9
|
||||
|
||||
![]()
Converting the table to text is unlikely to resolve your problems.
The following macro will repair all except the last row of your table: Code:
Sub FixTable() Application.ScreenUpdating = False Dim r As Long, c As Long, RngSrc As Range, RngTgt As Range With ActiveDocument.Tables(1) For r = .Rows.Count To 3 Step -1 IsDate (Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0))) If IsDate(Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0))) = False Then For c = 1 To .Rows(r).Cells.Count Set RngSrc = .Cell(r, c).Range If RngSrc.Paragraphs.Count > 1 Then RngSrc.End = RngSrc.Paragraphs(1).Range.End - 1 Set RngTgt = .Cell(r - 1, c).Range With RngTgt .End = .End - 1 .Collapse wdCollapseEnd .FormattedText = RngSrc.FormattedText .InsertBefore " " End With RngSrc.Paragraphs(1).Range.Text = vbNullString End If Next End If Next End With Application.ScreenUpdating = True End Sub For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
![]()
Paul. Thanks for writing the macro. What is the macro exactly for. ? I don't see much change in the table. After inserting the code in a module, the rows are still not in the order as per date. I also tried copying the document to excel and the values at each row at each change in display are not showing in order. The value connected to one date is merged with the next date.
This is the first time I have inserted a module in the word document and saved it as Word micro enabled document. I hope I have done it right. |
#11
|
||||
|
||||
![]()
I suggest you check the before & after screenshots more closely. With 01-08-2018, for example, you'll see that all dates are now aligned to the top of the cell and, where it previously didn't, the first line of each multi-line cell has been moved to the previous row (see especially the narration column).
The process relies on the affected rows having two or more paragraphs in each cell, so it isn't foolproof and the results will still need visual checking, particularly for the cheque column.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
![]()
I checked the data after running the code. Only that particular row is right. All the other rows are not affected by the code. This is just a sample data. Imagine where there are more than 500 rows of data, then I will have to clean each and every row to get it right. If the sample data works accurately, I could try it on the original data.
As the document is converted into pdf and I am trying to convert the pdf to document once again, there has to be some way to get each transaction separated from each other at each change in date. I am just trying to know and understand the pattern how it was done. The option in word document is also giving the same result if I convert it to table. |
#13
|
||||
|
||||
![]()
You really need to pay more attention to the before & after conditions. Compare the following screenshots and you will find that, except for the last row, every row where the date was not at the top has changed.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
![]()
Paul I have manually completed the cleaning of the data. The 5 rows dated 02-08-2017 except the first row all others are mixed up. Lines PCD.. & Services are of one date in the 2nd and 3rd row dated 02-08-2017. The fourth row begins from Sent IMPS and the 5th row begins with Recd. IMPS. You have inserted the lines below the date. If you get the lines above the date then I think it will be good. I hope you understood the problem. Where there are multiple lines in one particular date it has to take the first line in the narration and then the next.
|
#15
|
||||
|
||||
![]()
I have NOT inserted lines below the dates -I have moved lines above the dates to the end of the rows above - which it seems is where they should be. But, as you haven't provided any screenshots or documents of your own showing what the before and after results should be, we can only guess at your requirements.
In any event, there is a limit to what one can do programmatically with such a mess. If you don't want to use the code I posted, that is up to you.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to draw a trendline but not show the original line? | Sunny Rio | Word | 0 | 09-03-2022 05:55 PM |
![]() |
kingston123 | Drawing and Graphics | 4 | 09-19-2018 03:44 AM |
![]() |
phamh | PowerPoint | 2 | 10-21-2014 02:26 PM |
![]() |
ZapoTeX | PowerPoint | 1 | 11-06-2012 02:03 AM |
![]() |
gsrikanth | Excel | 1 | 03-07-2012 05:50 AM |