Sha256: 9a5e35b8c43013ed4fab6750df5d17e1b6d41b8a30e5201ebcd6e19632c2618e

Contents?: true

Size: 965 Bytes

Versions: 18

Compression:

Stored size: 965 Bytes

Contents

FileDir = File.expand_path(File.dirname(__FILE__))
load "#{FileDir}/word.rb"
load "#{FileDir}/excel.rb"

word = Word.new
word.show
word.display_alerts = false
doc = word.init_document
text = doc.add_text

# 测试文本
text.section("Cover 1") do 
	"数据通信网络高级巡检报告\n巡检时间:2017-04-12"
end

# 测试表格
text.style("正文")
text.add_table(2,2) do |tbl|
	tbl.merge_row
	tbl << ["1", "2", "3"]
end
text.entry

# 测试图片
text.add_head_image(File.join(FileDir, "..", "picture.png"))
text.page_break
path = File.join(FileDir, "..", "line.png")

text.add_image(path)

# 测试图表
tbl = [
	["a", "1"],
	["b", "2"],
	["c", "3"],
	["d", "4"],
]
text.chart(tbl) do |chart|
	chart.title = "Name"
	chart.type = 5
	#chart.axes_x = "year"
	#chart.axes_y = "value"
	chart.style = 251
end

# 测试目录
doc.create_catalog

text.section("标题 1") do
	"a"
end
text.entry
text.section("标题 1") do
	"b"
end
text.entry

doc.update_catalog

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
aio_elin-1.1.8 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.7 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.4 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.3 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.2 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.1 lib/aio/base/toolkit/test_word.rb
aio_elin-1.1.0 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.9 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.8 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.7 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.6 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.5 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.4 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.3 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.2 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.1 lib/aio/base/toolkit/test_word.rb
aio_elin-1.0.0 lib/aio/base/toolkit/test_word.rb
aio_elin-0.0.1 lib/aio/base/toolkit/test_word.rb