• beyondcompare 的word 直接转txt 脚本


    自带的word转换不稳定,直接调用word转出来的格式好看,缺点当然是依赖word。

    命令行:wscript Helpers\doc2txt.vbs %s %t

    脚本内容:(转换UTF-8的文本格式)

    ' ==> doc2txt.cmd <==
    ' cscript //Nologo "%~dpn0.vbs" "%~1"
    ' if errorlevel 1 pause
    
    Option Explicit
    On Error Resume Next
     
    Dim objWordApp
    Dim objWordDoc
    
    Dim objFileSys
    Dim objFile
    
    Dim strWordFilePath
    Dim strTextFilePath
     
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    
    
    strWordFilePath = WScript.Arguments(0)
    Set objFile     = objFileSys.GetFile(strWordFilePath)
    
    strTextFilePath = WScript.Arguments(1)
    
    
    Set objWordApp = WScript.CreateObject("Word.Application")
    
    If Err.Number = 0 Then
      'WScript.Echo "create success"
    
      Set objWordDoc = objWordApp.Documents.Open(objFile.Path, false, true)
      'WScript.Echo "will save to" & strTextFilePath
      If Err.Number = 0 Then
    
        'WScript.Echo "open success"
        objWordDoc.SaveAs2 strTextFilePath, 2, false, "", true, "", false, false, false, false, false, 65001
     
        objWordDoc.Close
        objWordApp.Quit
      Else
        WScript.Echo "error:" & Err.Description
      End If
    Else
      WScript.Echo "error:" & Err.Description
    End If
     
    Set objWordDoc = Nothing
    Set objWordApp = Nothing
    Set objFileSys = Nothing
    Set objFile    = Nothing
  • 相关阅读:
    c++ 动态生成string类型的数组
    c++ string类型的定义及方法
    c++数字和字符串的转换
    c++ 怎么输出保留2位小数的浮点数
    c++中结构体sort()排序
    O(N)时间的排序
    复杂链表的复制
    反转链表
    判断是否为平衡二叉树
    学习笔记_过滤器详细_2(过滤器JavaWeb三大组件之一)
  • 原文地址:https://www.cnblogs.com/dongzhiquan/p/15693748.html
Copyright © 2020-2023  润新知