Code Monkey home page Code Monkey logo

htmltoword's People

Contributors

anitsirc avatar jeppeliisberg avatar jharbert avatar mdh avatar nickfrandsen avatar tobiashm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

htmltoword's Issues

Request: debug mode

I'm getting a lot of line breaks in my document. I'm not entirely sure what's being fed into the converter. WickedPDF can enable debug mode with a URL parameter. I'd like to do the same with htmltoword. Something like this:

http://domain.com/controller/export.docx?debug=true

If I have the time, I might be able to contribute this but time is short these days.

compilation error: element html xsltParseStylesheetProcess : document is not a stylesheet

I am probably missing something obvious, but I have not yet succeeded in generating a docx file with this gem.
I'm running rails 4.2.0 with ruby 2.2.0
I've added the gem to my gemfile and bundle install
I noticed that the template and xslt files were not downloaded, so I downloaded them manually and saved them the lib directory.

I've tried messing around with the configuration i orderto point to the correct lib folder - both in the gem as well as in my rails project.

The mentioned error message appears here in my controller:

  def download
    respond_with(@case, content: '<html><body>some html</body></html>')
  end

Any help is greatly appreciated!

Images support

Hi !

I'd like to know if images can be supported by your gem. I suppose not because it didn't worked for me and I can't see any reference to images or <img> tags in your source code (I only searched for it a bit).

If it is not supported yet, I'd be happy to try to implement it if you can guide me, since I don't know XSLT.

But I imagine some kind of HTML pre-processing to download images and reference them directly from inside the generated .docx "zip" file may do the trick - or maybe not ?

Thanks for your work though, it works nicely for the rest of the document, and a ruby solution is really appreciated here.

Images

Is possible support to insert image tag?

Setting fonts and sizes

This is a feature request for the ability to set a font and font size for a document, paragraph, or both.

Looking into the WordprocessingML doc, it appears you can either explicitly list the font and size on a run every time, or create a document style and apply that style to the run.

Perhaps we could apply a font-size and font-family style to the body tag and have that body style propagate to all runs under it, or apply a style to a paragraph and have the run use that paragraphs style.

Something like this appears to work:

    <w:p>
      <w:r>
        <w:rPr>
          <w:sz w:val="50"/>
          <w:rFonts w:ascii="Times New Roman" />
        </w:rPr>
        <w:t xml:space="preserve">This paragraph is Times New Roman at 25pt</w:t>
      </w:r>
    </w:p>

missing default template/xslt files in the gem install

I'm using RVM with Ruby 2.2.0 and when I try to use the gem I get path issues along the following lines:

Zip::Error (File /Users/jon/.rvm/gems/ruby-2.2.0@custom-gemset/gems/htmltoword-0.2.0/lib/htmltoword/templates/default.docx not found):
  app/controllers/welcome_controller.rb:6:in `block in index'
  app/controllers/welcome_controller.rb:5:in `index'

Looking in the gemset folder for the gem files shows they are not there either.

Support for Ruby 2.1.2

After I bundle install the gem, when I load the library, this is what happened:

[1] pry(main)> require 'htmltoword'
NameError: constant Logger::Format not defined
from /srv/scholar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionpack-1.4.0/lib/action_controller/support/clean_logger.rb:5:in `remove_const'

ruby version: 2.1.2

White space being added before and after element

I created a word document using version 1.8 of htmltoword. It was interpreted fine in Openoffice, but after trying to open with a copy of microsoft word, the software reported the file was corrupted. I upgraded to version 2.0 and copied to the xslt to where I believe was the correct place, and regenerated the document. This document could be opened in word, but alot of preserve whitespace xml nodes were added, creating undesirable formatting. Is there something im missing here? I removed everything complex in the end, and tried to just render a paragraph, but still excessive white space appeared above and below the paragraph in the produced word document. I can attempt to write another xslt, but I'm wondering if there's anything obvious that ive missed....

NameError: uninitialized constant Zip::File

Hello Guys,

I got strange error with rubyzip:

file = Htmltoword::Document.create my_html, file_name
NameError: uninitialized constant Zip::File
from /home/..../gems/htmltoword-0.1.8/lib/htmltoword/document.rb:46:in `block in save'

Thanks for any help )

Link support

First - thanks for making this thing, it's a big challenge.

I'm wondering about link support.

<a href="#asdf">news</a>

That's just outputting line breaks for the opening and closing A tags.

understanding html layout

I'm having trouble applying a fixed width to a set of div's. When viewed in the word file, it doesn't seem to be working.

`

Label 1

Label 2
`

Also, if you don't mind clarifying what this is meant to do params[:docx_html_source]

Thank you!

Ability to set line spacing

This is a feature request to add the ability to set line spacing on a body or paragraph level (similar to #19)

The line spacing is set on paragraph level with a line spacing of 1 set to the value 240, 1.5 is then 360, and 2 is 480.

The following paragraph property seems to work:

<w:pPr>
  <w:spacing w:line="480" />
</w:pPr>

Centering things

How do I center things when exporting. Is there documentation or a way to do this and other things found in word?

Error while starting rails server after adding htmltoword gem

I'm added to Gemfile gem 'htmltoword', '0.2.0' into a new rails 4.2.1 app. But than i starts a rails server an error appear.

/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/htmltoword-0.2.0/lib/htmltoword/action_controller.rb:41:in `': uninitialized constant ActionController::Responder (NameError)
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/htmltoword-0.2.0/lib/htmltoword.rb:26:in `require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/htmltoword-0.2.0/lib/htmltoword.rb:26:in `'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `each'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `block in require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `each'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.5/lib/bundler.rb:134:in `require'
        from /vagrant/HtmlWordConverter/config/application.rb:7:in `'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `'
        from bin/rails:4:in `require'
        from bin/rails:4:in `'

After removing gem rails server starts normally. What problem in? What versions of Ruby/Rails supported? I tried ruby versions 2.0, 2.1.5, 2.2.2 and Rails 4.2.1. Same problem persist.

uninitialized constant Mime::DOCX

With htmltoword version >= 0.2 there's no need to declare the mime-type, but I'm using htmltoword ver 0.5.1. I can't fix this "uninitialized constant Mime::DOCX" error. I need help.

undefined method `gsub' for nil:NilClass

In my action when I call

respond_to do |format|
  format.docx do
    file = Htmltoword::Document.create params[:docx_html_source], "file_name.docx"
    send_file file.path, :disposition => "attachment"
  end
end

I get an error

undefined method `gsub' for nil:NilClass

on

file = Htmltoword::Document.create params[:docx_html_source], "file_name.docx"

line

I use 0.1.8 verison of htmltoword on rails 4.1.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.