Skip to content

Commit

Permalink
Add WRI format support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecot committed Nov 17, 2023
1 parent e1f37cd commit 19f625a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## New formats support

- Microsoft Write (WRI)
- Picture Exchange (PCX)

# Version 0.22.0 (2023-11-04)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ file-format = "0.23"
- Microsoft Works 6 Spreadsheet (XLR)
- Microsoft Works Spreadsheet (WKS)
- Microsoft Works Word Processor (WPS)
- Microsoft Write (WRI)
- Office Open XML Document (DOCX)
- Office Open XML Drawing (VSDX)
- Office Open XML Presentation (PPTX)
Expand Down
Binary file added fixtures/document/sample.wri
Binary file not shown.
7 changes: 7 additions & 0 deletions src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,13 @@ formats! {
extension = "wps"
kind = Document

format = MicrosoftWrite
name = "Microsoft Write"
short_name = "WRI"
media_type = "application/x-mswrite"
extension = "wri"
kind = Document

format = Mobipocket
name = "Mobipocket"
short_name = "MOBI"
Expand Down
4 changes: 4 additions & 0 deletions src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,10 @@ signatures! {
value = b"GIF87a"
value = b"GIF89a"

format = MicrosoftWrite
value = b"\x31\xBE\x00\x00\x00\xAB"
value = b"\x32\xBE\x00\x00\x00\xAB"

format = SevenZip
value = b"\x37\x7A\xBC\xAF\x27\x1C"
value = b"\x37\x7A\xBC\xAF\x27\x1C"
Expand Down
6 changes: 6 additions & 0 deletions tests/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ fn test_microsoft_works_word_processor() {
assert_eq!(fmt, FileFormat::MicrosoftWorksWordProcessor);
}

#[test]
fn test_microsoft_write() {
let fmt = FileFormat::from_file("fixtures/document/sample.wri").unwrap();
assert_eq!(fmt, FileFormat::MicrosoftWrite);
}

#[cfg(feature = "reader-zip")]
#[test]
fn test_office_open_xml_document() {
Expand Down

0 comments on commit 19f625a

Please sign in to comment.