Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gemspec
21 changes: 21 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2001-2015 Aspose Pty Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Aspose_Cells_Java_For_Ruby
Aspose Cells Java for Ruby is a gem that demonstrates / provides the Aspose.Cells for Java API usage examples in Ruby by using Rjb - Ruby Java Bridge.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'asposecellsjava'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install asposecellsjava

To download Aspose.Cells for Java API to be used with these examples through RJB, Please navigate to:

http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/

For most complete documentation of the project, check Aspose.Cells Java for Ruby confluence wiki link:

http://www.aspose.com/docs/display/cellssjava/3.+Aspose.Cells+Java+For+Ruby

## Usage

```ruby
require '../lib/asposecellsjava'
include Asposecellsjava
include Asposecellsjava::HideUnhideWorksheet
initialize_aspose_cells
```
Lets understand the above code
* The first line makes sure that the aspose cells is loaded and available
* Include the files that are required to access the aspose cells
* Initialize the libraries. The aspose JAVA classes are loaded from the path provided in the aspose.yml file
2 changes: 2 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "bundler/gem_tasks"

27 changes: 27 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/asposecellsjava.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'asposecellsjava/version'

Gem::Specification.new do |spec|
spec.name = 'asposecellsjava'
spec.version = Asposecellsjava::VERSION
spec.authors = ['Aspose Marketplace']
spec.email = ['marketplace@aspose.com']
spec.summary = %q{A Ruby gem to work with aspose.cells libraries}
spec.description = %q{AsposeCellsJava is a Ruby gem that can help working with Aspose.Cells libraries}
spec.homepage = 'https://github.com/asposecells/Aspose_Cells_Java/tree/master/Plugins/Aspose_Cells_Java_for_Ruby'
spec.license = 'MIT'

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_development_dependency 'bundler', '~> 1.7'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'

spec.add_dependency 'rjb', '~> 1.5.2'

end
5 changes: 5 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/config/aspose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jar_dir: ../asposecellsjava/jars
license_path: ../asposecellsjava/license/path
jvm_args: -Xms512m -Xmx1G


Binary file not shown.
26 changes: 26 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<title>Sample "Hello, World" Application</title>
</head>
<body bgcolor=white>

<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/springsource.png">
</td>
<td>
<h1>Sample "Hello, World" Application</h1>
</td>
</tr>
</table>

<p>This is the home page for the HelloWorld Web application. </p>
<p>To prove that they work, you can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="hello">servlet</a>.
</ul>

</body>
</html>
71 changes: 71 additions & 0 deletions Plugins/Aspose_Cells_Java_for_Ruby/lib/asposecellsjava.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
require_relative 'asposecellsjava/version'
require_relative 'asposecellsjava/asposecells'
require 'logger'
require 'rjb'

module Asposecellsjava

class << self
attr_accessor :aspose_cells_config
end

def initialize_aspose_cells
aspose_jars_dir = Asposecellsjava.aspose_cells_config ? Asposecellsjava.aspose_cells_config['jar_dir'] : nil
aspose_license_path = Asposecellsjava.aspose_cells_config ? Asposecellsjava.aspose_cells_config['license_path'] : nil
jvm_args = Asposecellsjava.aspose_cells_config ? Asposecellsjava.aspose_cells_config['jvm_args'] : nil

load_aspose_jars(aspose_jars_dir, jvm_args)
load_aspose_license(aspose_license_path)
end

def load_aspose_license(aspose_license_path)
if aspose_license_path && File.exist?(aspose_license_path)
set_license(File.join(aspose_license_path))
else
logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.warn('Using the non licensed aspose jar. Please specify path to your aspose license directory in config/aspose.yml file!')
end
end

def load_aspose_jars(aspose_jars_dir, jvm_args)
if aspose_jars_dir && File.exist?(aspose_jars_dir)
jardir = File.join(aspose_jars_dir, '**', '*.jar')
else
jardir = File.join(File.dirname(File.dirname(__FILE__)), 'jars', '**', '*.jar')
end

if jvm_args
args = jvm_args.split(' ') << '-Djava.awt.headless=true'
logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG
logger.debug("JVM args : #{args}")
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=args)
else
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=['-Djava.awt.headless=true'])
end

end

def input_file(file)
Rjb::import('java.io.FileInputStream').new(file)
end

def set_license(aspose_license_file)
begin
fstream = input_file(aspose_license_file)
license = Rjb::import('com.aspose.api.License').new()
license.setLicense(fstream)
rescue Exception => ex
logger = Logger.new(STDOUT)
logger.level = Logger::ERROR
logger.error("Could not load the license file : #{ex}")
fstream.close() if fstream
end
end

def self.configure_aspose_cells config
Asposecellsjava.aspose_cells_config = config
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require_relative 'hideunhideworksheet'
require_relative 'displayhidetabs'
require_relative 'displayhidescrollbars'
require_relative 'displayhidegridlines'
require_relative 'displayhiderowcolumnheaders'
require_relative 'pagebreakpreview'
require_relative 'zoomfactor'
require_relative 'freezepanes'
require_relative 'splitpanes'
require_relative 'managingworksheets'
require_relative 'pagebreaks'
require_relative 'copyworksheets'
require_relative 'converter'
require_relative 'encrypt'
require_relative 'document'
require_relative 'rowsandcolumns'
require_relative 'protection'
require_relative 'pagesetup'
Loading