txt_docx 2.0.0 copy "txt_docx: ^2.0.0" to clipboard
txt_docx: ^2.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';

    await File(f)
        .openRead()
        .transform(utf8.decoder)
        .transform(DocxEncoder())
        .pipe(File(docx).openWrite());

    final wf = File(docx);
    await DocxDecoder()
        .open(wf.openSync())
        .transform(utf8.encoder)
        .pipe(File('$docx.txt').openWrite());
  }
}
1
likes
160
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

path, xml, zip2

More

Packages that depend on txt_docx