자주 묻는 질문/일반/150

    From The Document Foundation Wiki
    < Faq‎ | General
    This page is a translated version of the page Faq/General/150 and the translation is 9% complete.
    Outdated translations are marked like this.

    노트

    .docx에서 .odt로의 변환에 대해 생각하겠지만, LibreOffice에서 지원하는 다른 형식들은 구문과 단계가 동일합니다.


    내용

    MS-Windows 10에서 우리는 my_document.docx의 형식을 MS docx에서 open document 형식 (odt)으로 바꾸기 위해 soffice.exe --convert-to odt my_document.docx 같은 커맨드를 사용할 수 있습니다. --convert-to 함수를 사용하면 파일에 대한 일반 와일드카드 구문을 사용하여 문서 집합을 지정할 수 있습니다. 예를 들어, 현재 디렉토리에서 변환할 .docx 파일이 여러 개 있는 경우 '*.docx'를 사용하는 것이 옳습니다.


    문제

    그러나 Windows Command shell에서 사용할 경우 이는 작동하지 않습니다. 모든 변환이 동시에 시작되는 것 같고, LibreOffice(soffice.exe)의 두 인스턴스가 명령줄에서 실행될 때 동시에 실행될 수 없으므로 프로세스가 결코 종료되지 않습니다. 기껏해야 한두 개의 파일이 변환되어 종료되지만, 어떤 경우든 시스템에 여러 개의 LibreOffice 프로세스를 수동으로 제거해야 합니다(처음 볼 때 발견된 파일 수의 두 배).


    해결책

    이를 해결하기 위한 간단한 방법은 MS에서 제공하는 새로운 Windows Subsystem for Linux Environment를 버전 10에서 사용하는 것입니다. 설치해야 할 테지만, 여기 https://docs.microsoft.com/en-us/windows/wsl/install-win10 의 설명서에 따르면 간단합니다.


    완료되면 기본 Windows 시스템 위에서 실행 중인 꽤 멋진 bash shell에 액세스할 수 있으며 --convert-to 기능이 동기화 모드에서 제대로 작동합니다.


    요약

    1. soffice.exe로 가는 경로를 식별합니다.
    2. 목적지 경로를 생성한 후, 변환할 파일이 포함된 경로로 갑니다.
    3. 본 커멘드를 입력합니다: <path to soffice.exe> --convert-to odt --outdir <my_output_directory> *.docx


    예시:

    "/mnt/c/Program Files/LibreOffice 5/program/soffice.exe" --convert-to odt --outdir ./Converted_To_odt *.docx 는 현재 위치의 docx파일을 ./Converted_To_odt 하위 경로에 변환합니다.


    왜?

    WSL은 전체 파일 시스템을 자체적으로 올라갑니다. 따라서 디렉터리 트리에서 파일 위치를 지정하는 구문이 윈도우즈 구문과 다릅니다. 첫 번째 차이점은 루트 포인트입니다. Windows에서 C:\로 사용되며, bash 셸에서 똑같은 게 /mnt/c/로 쓰입니다. 그리고, 윈도우에서는 토큰 구분 기호를 \로 사용하고 Unix에서는 /를 씁니다. 나머지 규칙은 동일하고, bash 셸은 두 개의 따옴표(")로 구분되는 경우 공백이 있는 긴 파일 이름 및 파일 이름뿐만 아니라 윈도우즈 명령 셸과 동일한 문자 집합을 지원합니다.


    커맨드는 어떠게 생성합니까?

    가장 쉬운 방법은 LibreOffice를 시작할 때마다 사용하는 바로가기를 검사하는 것입니다. 그 위로 오른쪽 마우스 클릭을 하고 "속성"을 누른 다음 "대상" 필드를 복사합니다. 예시로 이는 "C:\Program Files\LibreOffice 5\program\soffice.exe" 가 될 수 있습니다. 그런 다음 앞에서 설명한 대로 구문을 bash 요구 사항에 맞게 조정하여 다음을 수행합니다: "/mnt/c/Program Files/LibreOffice 5/program/soffice.exe" 주의하세요. Unix는 대소문자를 구분하지만 Windows는 그렇지 않습니다.


    그외에는, 끝났습니다.


    결론

    Windows에서 bash shell을 사용하면 LibreOffice builtin 명령줄 기능을 사용하여 여러 파일을 형식에서 다른 형식으로 쉽게 변환할 수 있습니다.


    아니면 가장 간단한 방법으로는, 상호작용하는

    builtin LibreOffice Document converter Assistant를 사용하는 게 더욱 간편합니다. 설명은 이곳에 있습니다: https://help.libreoffice.org/latest/en-US/text/shared/autopi/01130000.html


    당신은 메뉴에서 Files - Assistants - Document Converter을 눌러 이를 시작할 수 있습니다.


    몇몇 사용자들은 프로세스상에서 충돌이 일어나는 경우가 있으므로, 최대 200개 까지만 변환하라고 이야기했습니다.

    The long description of the problem

    The problem is not that "all the conversions are started simultaneously". It's simply that LibreOffice's --convert-to in fact does not support using wildcards itself, and only works on non-Windows systems because they process the wildcards in their shells (and of course, these shells also work on Windows, like with Cygwin or WSL).

    What does this mean? This means that in Bash, when you send a command like soffice --convert-to odt path/to/*.doc, the command is first analyzed by Bash, and it finds the path/to/*.doc there, and enumerates every file that matches the mask, puts their names into one string, and substitutes the path/to/*.doc with something like path/to/1.doc path/to/2.doc path/to/345.doc. This is what LibreOffice sees.

    Windows' cmd.exe does not do that, and sends the path/to/*.doc to LibreOffice unmodified. LibreOffice simply tries to open the file named *.doc, and fails. That's all.

    In Windows' cmd.exe, the pre-processing should be done explicitly, like this:

    for %f in ("path\to\*.doc") do "C:\Program Files\LibreOffice\program\soffice" --convert-to odt "%f"

    The enhancement request to implement own wildcard processing is tdf#48413.