例如。
我有以下文件数据
<f:facet name="header"><h:outputText value="#{pqfn:format('FILENAME')}" /></f:facet>
<h:outputText value="#{file.file.notes}"/>
</t:column>
<t:column>
<br></br><h:outputText value="#{pqfn:format('INVALID_DEALER_CODE')}"/>
<f:facet name="header"><h:outputText value="#{pqfn:format('STATUS')}" /></f:facet>
<h:outputText value="#{bm:getStatusText(file)}"/>
</t:column>
<t:column>
<f:facet name="header"><h:outputText value="#{pqfn:format('PERIOD')}" /></f:facet>
<h:outputText rendered="#{file.status == 0}" value="#{pqfn:formatPeriod(file.period)}"/>
</t:column>
<t:column>
<f:facet name="header"><h:outputText value="#{pqfn:format('DEALER')}" /></f:facet>
<h:outputText rendered="#{file.status == 0}" value="#{file.networkEntity.name}"/>
</t:column>
<t:column align="left">
<f:facet name="header"> </f:facet>
<h:selectBooleanCheckbox disabled="#{file.status != 0}" value="#{file.processed}" id="process"/>
<h:outputLabel for="process" value="#{pqfn:format('PROCESS')}" />
</t:column>
</t:dataTable>
</td>`enter code here`
</tr>
<tr>
<td align="center" style="height:40px">
<h:commandButton action="#{submissions.processDmsFiles}" value="#{pqfn:format('PROCESS')}" disabled="#{! submissions.someProcessed}" styleClass="form-button" />
 
<h:commandButton action="#{submissions.dmsImport}" value="#{pqfn:format('CANCEL')}" immediate="true" styleClass="form-button" />
</td>
我需要在单独的Excel工作表中将以下值作为输出
文件名 INVALID_DEALER_CODE 状态 期 经销商 过程
以此类推。
谢谢
答案 0 :(得分:0)
这应该可以工作(但是每行一个搜索输出):
Sub Search()
Const strFileName = "C:\User\YourTextfile.txt" 'Textfile path
Const strSearch = "'" 'Textfile search char
Dim strLine As String
Dim f As Integer
Dim lngLine As Long
Dim char1Pos As Integer
char1Pos = 1
Dim char2Pos As Integer
Dim strText As String
f = FreeFile
Open strFileName For Input As #f
Do While Not EOF(f)
lngLine = lngLine + 1
Line Input #f, strLine
If InStr(char1Pos, strLine, strSearch, vbBinaryCompare) > 0 Then
char1Pos = InStr(1, strLine, strSearch, vbBinaryCompare)
char2Pos = InStr(char1Pos + 1, strLine, strSearch, vbBinaryCompare)
strText = Mid(strLine, char1Pos + 1, (char2Pos - char1Pos) - 1)
Debug.Print strText
End If
Loop
Close #f
End Sub