Description: Removes blank lines from within a text file. Blank lines include those with none or only space characters.
Parameters:
DeleteEmptyLinesFromTextFile(sSourceFile As String, sTargetFile As String) As Long
|
Parameter |
Meaning |
|
SSourceFile |
Text file to modify |
|
STargetFile |
If same as sSourceFile, DeleteEmptyLinesFromText will modify the original file. Otherwise, it will create a new, modified file. |
Return Values:
0: Success
-2: Unable to open original file
-3: Unable to open target file
-201: "Shareware has expired"
Example Code:
The code below is taken from the sample VB program provided. It demonstrates both the ConcatenateTwoTextFiles() and DeleteEmptyLinesFromTextFile methods.
Private Function PerformTextSpecialProcess(lngProcess As Long, _
strSourceFile As String, _
strTargetFile As String) _
As Long
Dim lngResult As Long
Select Case (lngProcess) 'choose which of the processes to execute
'then call the component
Case SP_CONCATENATE_TEXT_FILES
lngResult = XLSConv1.ConcatenateTwoTextFiles(strSourceFile,
strTargetFile)
Case SP_REMOVE_EMPTY_LINES_FROM_TEXT_FILE
lngResult = XLSConv1.DeleteEmptyLinesFromTextFile _
(strSourceFile, strTargetFile)
End Select
If (lngResult = 0) Then 'checks that a file was created using the
'helper function, FileExists
If (FileExists(strTargetFile) = False) Then
lngResult = -100
End If
End If
Select Case (lngResult) 'if error, display appropriate message
Case -1
strErr = "Unable to Complete Requested Process"
Case -100
strErr = "File does not exist."
End Select
PerformTextSpecialProcess = lngResult
End Function