文件格式任意转换助手Transfer Any File

离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser

TXT 转 Word 文档——离线、可批量、不上传TXT to Word document offline, in batches, no upload

「把 txt 丢进 Word」看起来是最简单的一步,真正决定结果的是产物里放了什么。这条链路先按纯文本的老规矩把文件转成 HTML:转义 `&`、`<`、`>`,把每个换行写成 `<br>`,整段包在 `<pre>` 里;再由 HTML 转 Word 把这份 HTML 封装成 MHTML altChunk 塞进 .docx——也就是说**排版发生在 Word 打开它的那一刻**,不是由扩展硬编码一份 XML。换来的是行与缩进的忠实保留,代价是不同 Word / LibreOffice 版本的观感可能不同。这条路上没有任何字体、页边距或颜色可继承:源文件本来就没有这些对象。“Turn a txt into Word” sounds like the easiest step in the world, and what decides the result is what the artefact actually contains. This route first converts the file with plain text’s own rules: `&`, `<` and `>` are escaped, every newline becomes `<br>`, and the block is wrapped in `<pre>`; HTML to Word then packages that document as an MHTML altChunk inside the .docx — which means **the layout happens when Word opens it**, rather than being hardcoded into XML this extension assembles. The reward is faithful lines and indentation; the price is that different Word and LibreOffice builds can present it differently. Nothing is inherited on the way: the source file has no fonts, margins or colours to carry over.

一批转换结果卡片,含文件名、体积与下载入口
一次混合批量,一个 ZIP 下载One mixed batch, one ZIP download

这条链路怎么走How the route runs

纯文本 (TXT)plain text (TXT) HTMLHTML Word (.docx)Word (.docx)

共 2 步,由扩展的路径搜索自动选出,中间产物不落盘。2 steps, chosen by the extension's own path search; intermediate results never touch the disk.

会保留什么What carries over

  • 每一行换行都成为 Word 里的一个换行,不会被折进同一段——日志、清单、代码片段转出去还是一行一条Every newline becomes a newline in Word instead of being folded into one paragraph, so logs, checklists and code snippets still read one item per line
  • 前导空格与制表符按 `<pre>` 的规矩原样保留,ASCII 画的表格和缩进层级转过去还认得出来Leading spaces and tabs are preserved exactly as `<pre>` holds them, so an ASCII table or an indented outline is still recognisable after the conversion
  • 文本里的 `&`、`<`、`>` 是作为字符出现的,不会被当成标签吃掉;文件名会写进文档标题The `&`, `<` and `>` inside your text appear as characters rather than being swallowed as markup, and the file’s own name becomes the document title
  • 编码不是前提:先按 BOM 与 NUL 分布嗅探 UTF-16,再依次尝试 UTF-8 → GB18030 → GBK;四种都读不出文本时直接报错,不产出一份乱码 .docxThe encoding is not a precondition: UTF-16 is sniffed from the BOM and the NUL pattern first, then UTF-8 → GB18030 → GBK are tried, and a file none of them can read fails instead of shipping a mojibake .docx

如实说明的限制What it does not do

  • 排版由 Word 决定:产物里是封装好的 altChunk,Word 打开时才渲染,所以行距、字体回退与分页位置在不同软件、不同版本之间会有差异——它不是字节级固定的版式Word owns the layout: the artefact holds a packaged altChunk and Word renders it when the file opens, so line spacing, font fallback and where pages break can differ across applications and versions — this is not a byte-fixed layout
  • 没有任何样式可继承:字号、字体、颜色、页边距全部取 Word 的默认值,想要样式请先在 Word 里加,或改走 Markdown 转 Word 让结构(标题、列表、表格)先进文档No styling is inherited: size, face, colour and margins all come from Word’s defaults. Style it in Word afterwards, or take Markdown to Word so structure (headings, lists, tables) enters the document first
  • 超长的一行不会被自动折断:`<pre>` 保留原样,宽行在 Word 里可能超出页宽。数据宽表请走 CSV 或 Excel 路线A very long line is not auto-wrapped: `<pre>` keeps it as written, so a wide row can run past the page. Data tables belong on the CSV or Excel route
  • 不生成图片、目录、页眉页脚或任何对象——纯文本里没有这些东西,转换也不会替你把它们凭空造出来No images, table of contents, headers or footers are generated — plain text contains none, and the conversion does not invent them for you
  • 一批最多 200 个文件、单个上限 100 MB;产物是 .docx 容器,多个文件一起转会打包成 ZIP 供一次拿走Up to 200 files per batch and 100 MB per file; the artefact is a .docx container, and several files together are handed over as one ZIP

实操提示Working with it

  • 想要一份真正能排版的文档:TXT → Markdown → Word,标题、列表与表格会以结构进文档,而不是当成一整块等宽文字For a document you really want to lay out: TXT to Markdown to Word, so headings, lists and tables enter as structure rather than as one block of monospaced text
  • 想要一页纸的图片或 PDF:TXT → PDF 走的是整页渲染成位图的路线,产物没有文字层,选中不了文字For a page image or PDF: TXT to PDF renders the whole page to bitmaps, so that artefact has no text layer and its words cannot be selected
  • 手上其实是数据表,只是存成了 .txt:先把分隔符当 CSV 读(TXT → CSV 或直接用 .csv),再转 Excel,列位置才稳If the file is actually a data table stored as .txt: read the separator as CSV first (TXT to CSV, or just use the .csv), then go to Excel, where the column positions stay put

常见问题Questions people actually ask

为什么排版要到 Word 打开时才定?Why is the layout decided when Word opens the file?

因为产物里封的是 MHTML altChunk:Word 按自己的 HTML 引擎渲染它。这样换来的是换行与缩进的忠实保留,也不必由扩展去拼一份 Word 的 XML 正文——代价就是不同软件的观感差异,这是刻意选的那一侧。Because the file carries an MHTML altChunk: Word renders it with its own HTML engine. That buys faithful lines and indentation without this extension hand-assembling WordprocessingML, and the price is that viewers can differ — the side deliberately chosen.

日志里有几百行,会丢吗?My log runs to hundreds of lines — will any be lost?

不丢。每个换行都写成 `<br>`,整段作为等宽块交给 Word;文本一个字符都不会被当标签解析(`&`、`<`、`>` 都先转义)。真正要注意的是超宽的单行不会被自动折行。None. Every newline becomes a `<br>` and the whole block is handed over as monospaced content; not one character is parsed as markup, because `&`, `<` and `>` are escaped first. The thing to watch is a very long line, which is not auto-wrapped.

中文和 emoji 会正常显示吗?Do Chinese text and emoji survive?

内容按 UTF-8 保留,不会替换成问号;实际用到的字形由 Word 的字体回退决定。如果某类字符在你的 Word 里显示成方框,那是字体问题,重转一次不会改变结果。The bytes stay UTF-8 and are not replaced with question marks; which glyphs you actually see is Word’s font fallback. If a character renders as a box in your Word, that is a font matter, and converting again changes nothing.

合同或病历这类文本会经过服务器吗?Do contracts or medical notes ever pass through a server?

不会。读文本、生成 HTML、封装 .docx 都在扩展自己的标签页里完成,只申请 storage 权限、没有 host 权限,产物里也没有把远端资源当代码执行的路径。No. Reading the text, building the HTML and packaging the .docx all happen inside the extension’s own tab: the storage permission only, no host permissions, and no path in the bundle that executes remotely hosted code.

不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.