txt_docx 1.0.0 copy "txt_docx: ^1.0.0" to clipboard
txt_docx: ^1.0.0 copied to clipboard

A simple tool that could convert plain text files to docx files and vice versa

example/example.dart

import 'dart:convert';
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:txt_docx/txt_docx.dart';

void main(List<String> argv) async {
  for (final f in argv) {
    final docx = '${p.basenameWithoutExtension(f)}.docx';

    final file = File(f);
    final writer = DocxWriter();
    await writer.writeStream(file.openRead(), docx);

    final wf = File(docx);
    await wf
        .openRead()
        .transform(DocxDecoder(wf.lengthSync()))
        .transform(utf8.encoder)
        .pipe(File('$docx.txt').openWrite());
  }
}
1
likes
140
points
21
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple tool that could convert plain text files to docx files and vice versa

License

Apache-2.0 (license)

Dependencies

archive, path, xml

More

Packages that depend on txt_docx