15,909,898 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by himanshu_88 (Top 4 by date)
himanshu_88
29-Aug-12 12:56pm
View
Actually i don't want to delete spaces between words, what i want is to delete spaces between paragraphs.
I am using the below code(its just the for loop) to read data from a Word file, paragraph by paragraph and then display it into a text box on the form. But the spaces which are present between paragraphs are also being displayed on the text box(as the code is treating it as a paragraph).
Therefore, is there anything how i can filter out the spaces(or even some special characters) and then remove them before displaying in the text box.
For Each p In currentDocument.Paragraphs
Next p
himanshu_88
29-Aug-12 12:10pm
View
hi, i tried this code but it is not removing the spaces.
The empty spaces are still being shown on the text box as paragraphs.
himanshu_88
29-Aug-12 11:45am
View
Deleted
Imports System
Imports System.IO
Imports Microsoft.Office.Interop
Public Class Form1
Dim p, p1, line
Dim currentIndex As Integer
Dim list As New List(Of String)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Dim myValue, path, Text1, myValue1, webBrowser1, email
Public Sub InputPath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InputPath.Click
path = InputBox("Input Path", "enter the path", "Path")
End Sub
Public Sub Notes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Notes.Click
myValue = InputBox("Probable Bugs", "Notes", "Notes")
myValue1 = myValue1 & vbCrLf & myValue
End Sub
Public Sub Display_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Display.Click
MsgBox(myValue1)
End Sub
Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objWord
Dim p
Dim wordPath
Dim currentDocument
Dim wscript
Dim num
wordPath = "C:\Users\c5167094\Desktop\123.docx"
objWord = CreateObject("Word.Application")
objWord.DisplayAlerts = 0
objWord.Documents.Open(wordPath, False, True)
currentDocument = objWord.Documents(1)
For Each p In currentDocument.Paragraphs
list.Add(p.range.text)
Next p
TextBox.Text = list(currentIndex)
currentDocument.Close()
currentDocument = Nothing
objWord.Quit()
objWord = Nothing
End Sub
Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
currentIndex = currentIndex + 1
TextBox.Text = List(currentIndex)
End Sub
End Class
himanshu_88
29-Aug-12 11:35am
View
will i be able to use trim() to delete all the spaces from an entire word document ?