Module: Uniword::ContentTypes
- Defined in:
- lib/uniword/content_types.rb,
lib/uniword/content_types/types.rb,
lib/uniword/content_types/default.rb,
lib/uniword/content_types/override.rb
Defined Under Namespace
Classes: Default, Override, Types
Class Method Summary collapse
-
.generate ⇒ Types
Generates [Content_Types].xml for DOCX packages This content tells Office what kind of content each part contains.
-
.generate_for_theme ⇒ Types
Generate [Content_Types].xml for THMX (theme) packages.
Class Method Details
.generate ⇒ Types
Generates [Content_Types].xml for DOCX packages This content tells Office what kind of content each part contains
Generate comprehensive [Content_Types].xml
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/uniword/content_types.rb', line 20 def generate Types.new( defaults: [ Default.new(extension: "jpeg", content_type: "image/jpeg"), Default.new(extension: "png", content_type: "image/png"), Default.new(extension: "gif", content_type: "image/gif"), Default.new(extension: "rels", content_type: "application/vnd.openxmlformats-package.relationships+xml"), Default.new(extension: "xml", content_type: "application/xml"), ], overrides: [ Override.new(part_name: "/word/document.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), Override.new(part_name: "/word/numbering.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"), Override.new(part_name: "/word/styles.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"), Override.new(part_name: "/word/settings.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"), Override.new(part_name: "/word/webSettings.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"), Override.new(part_name: "/word/fontTable.xml", content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"), Override.new(part_name: "/word/theme/theme1.xml", content_type: "application/vnd.openxmlformats-officedocument.theme+xml"), Override.new(part_name: "/docProps/core.xml", content_type: "application/vnd.openxmlformats-package.core-properties+xml"), Override.new(part_name: "/docProps/app.xml", content_type: "application/vnd.openxmlformats-officedocument.extended-properties+xml"), ], ) end |
.generate_for_theme ⇒ Types
Generate [Content_Types].xml for THMX (theme) packages
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/uniword/content_types.rb', line 61 def generate_for_theme Types.new( defaults: [ Default.new(extension: "rels", content_type: "application/vnd.openxmlformats-package.relationships+xml"), Default.new(extension: "xml", content_type: "application/xml"), ], overrides: [ Override.new(part_name: "/theme/theme1.xml", content_type: "application/vnd.openxmlformats-officedocument.theme+xml"), ], ) end |