mac下有批量把docx转换为txt/md/pdf的工具么?

网上找了下,在线版的基本都是单文件的,问题是有几百个docx,机械重复不现实

小工具都是win下面的,没有mac,

请问大佬,mac下有批量的办法么?

谢谢

11 个赞

给你撸了个VBA, 放在word里面跑就行。

Sub SaveDocxAsTxtInFolder()

  Dim objFSO As Object
  Dim objFolder As Object
  Dim objFile As Object 
  Dim strFolderPath As String
  Dim strNewFileName As String
  Dim objDoc As Document 


  With Application.FileDialog(msoFileDialogFolderPicker)
    .Title = "选择包含.docx的文件夹"
    .AllowMultiSelect = False
    If .Show = -1 Then
      strFolderPath = .SelectedItems(1)
    Else
      MsgBox "未选择文件夹", vbExclamation
      Exit Sub
    End If
  End With


  Set objFSO = CreateObject("Scripting.FileSystemObject")


  Set objFolder = objFSO.GetFolder(strFolderPath)


  For Each objFile In objFolder.Files
    If Right(objFile.Name, 5) = ".docx" Then
      strNewFileName = Left(objFile.Name, Len(objFile.Name) - 5) & ".txt"
      Set objDoc = Documents.Open(objFile.Path)
      objDoc.SaveAs2 FileName:=objFolder.Path & "\" & strNewFileName, _
                   FileFormat:=wdFormatText 
      objDoc.Close SaveChanges:=wdDoNotSaveChanges

    End If
  Next objFile

  Set objDoc = Nothing
  Set objFile = Nothing
  Set objFolder = Nothing
  Set objFSO = Nothing

  MsgBox "转换完毕", vbInformation

End Sub
8 个赞

感谢大神,mac下也能跑vba么?

少部分阉割版office可能有问题,其他应该都可以的~

3 个赞

这个好是好,小白还是想要那种带GUI界面的,哈哈

首先要问一下是不是都是纯文字的,那就好办点,直接网页搜在线word转就行了,如果是带图片或者表格的话,md和pdf还好处理,txt就无了

在线的没法批量,这个很不好,100多份文件,一个一个点太费时间和精力了

mac下有libreoffice,brew安装后可以批量转换

 brew install libreoffice  
 soffice --headless --convert-to pdf *.docx

2 个赞

NeatConverter

1 个赞

欢迎技术大佬出没

微软推出 GitHub - microsoft/markitdown: Python tool for converting files and office documents to Markdown.