I have whatsapp chats in .txt file format. I want it to convert to original whatsapp format (i.e whatsapp original interface). The input is .txt file
Example:
12/11/2014, 12:22 PM - John: Hi Stacy
12/11/2014, 12:22 PM - John: :)
13/11/2014, 2:59 AM - John: How are you?
13/11/2014, 2:59 AM - John: Are u home?
13/11/2014, 8:09 AM - Stacy: Hi John
13/11/2014, 8:10 AM - Stacy: yeah I am good
13/11/2014, 8:10 AM - Stacy: and home too
13/11/2014, 9:14 PM - John: ok
16/11/2014, 4:14 PM - Stacy: how are you?
16/11/2014, 4:16 PM - John: I am good too
16/11/2014, 4:16 PM - John: See u tmrw at work
16/11/2014, 4:16 PM - John: :)
16/11/2014, 4:24 PM - Stacy: yeah ok
Now, I want the output in a Word doc with a similar interface as that of whatsapp.
[i.e., all chats by John on left side and by Stacy on right side]
I tried to do that by importing this .txt file into excel and then editing in word. But that didn't work.
Required output format:
Please click here to view the required output word format (Its very similar to whatsapp format)
This is what I did:
1) I imported the data in excel from .txt file.
2) I used python code to convert that txt format to excel file Please click here to view that file
3) I then copied this to .doc file and added borders
4) And now I removed output border. That's how I got the format I attached in the first link.
The problem that I am facing is wherever the text is not there, I need to manually go that cell and select "No Border". I am having 1000's of these.
Is there anyway I can do this programmatically?
Can something be done using Word or Excel VBA?
If you already have table as shown in image what you can do is remove the all boarder and run following code.
Sub demo1()
With ActiveDocument.Range
Dim oCell As Cell
Dim oRow As Row
'remove all boarders before executing this code
For Each oRow In .Tables(1).Rows
For Each oCell In oRow.Cells
If Not oCell.Range.Text = Chr(13) & Chr(7) Then
Set rng = oCell.Range
With rng
With .Borders(wdBorderTop)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With .Borders(wdBorderLeft)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With .Borders(wdBorderBottom)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With .Borders(wdBorderRight)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
End With
End If
Next oCell
Next oRow
End With
End Sub