Excel读取文本文件删除报价

时间:2017-12-05 13:24:24

标签: excel vba excel-vba

我正在尝试将文本文件读入Excel,其中包含以下内容:

  

" DVXX = 2.37"

     

" DVID = 1.967"

     

" WLXX = 1906"

我创建了一个循环,用于查找特定关键字,例如DVXX,偏移并报告值:

Open strFile For Input As #intFile
For i = 1 To 23
Do While Not EOF(intFile)
    Line Input #intFile, strIn
    Key_len = Len(Keywords(i))
    If Left(strIn, Key_len) = Keywords(i) Then
        strOut = Mid(strIn, Key_len + 3)
        Cells(25 + i, 1).Value = Keywords(i)
        Cells(25 + i, 2).Value = strOut
        Exit Do
    End If
    On Error Resume Next
Loop
Next i
Close #intFile

当我浏览并删除所有引用时,此代码正常工作,但生成的文本文件将有引号。有没有办法在不手动删除引号的情况下读取此信息?

1 个答案:

答案 0 :(得分:0)

阅读完行后立即添加:

public boolean handleFault(SOAPMessageContext context) {  
        System.out.println("==============================================RESPONSE(ERROR)=======================================\r\n");  

        String[] abc= context.get(MessageContext.HTTP_RESPONSE_HEADERS).toString().split("],");

        for(String httpheader:abc) {
            System.out.println(httpheader+"],");
        }

        System.out.println("\r\n");

        SOAPMessage message= context.getMessage();                  
        try {                                           
            Source source = message.getSOAPPart().getContent();             
            Transformer transformer = TransformerFactory.newInstance().newTransformer();             
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");                                                 
            transformer.transform(source, new StreamResult(System.out));

        } catch (Exception e) {            
                System.out.println("Response has errors!!");
            }
        return false;  
    }