13 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-23
15 | android.library.reference.1=../appcompat_v7
16 |
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/com/lxj/execldemo/Order.java:
--------------------------------------------------------------------------------
1 | package com.lxj.execldemo;
2 |
3 | import java.io.Serializable;
4 |
5 | import org.json.JSONObject;
6 |
7 | public class Order implements Serializable {
8 |
9 | public String id;
10 |
11 | public String restPhone;
12 |
13 | public String restName;
14 |
15 | public String receiverAddr;
16 |
17 |
18 | public Order(String id,String restPhone, String restName, String receiverAddr) {
19 | this.id = id;
20 | this.restPhone = restPhone;
21 | this.restName = restName;
22 |
23 | this.receiverAddr = receiverAddr;
24 | }
25 |
26 | public Order(JSONObject obj) {
27 | this.id = obj.optString("order_number");
28 | this.restPhone = obj.optString("Rphone");
29 | this.restName = obj.optString("Rname");
30 | this.receiverAddr = obj.optString("receiver_address");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | execlDemo
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/com/lxj/execldemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.lxj.execldemo;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Date;
5 | import java.util.List;
6 |
7 |
8 |
9 | import android.app.Activity;
10 | import android.database.DatabaseUtils;
11 | import android.os.Bundle;
12 | import android.os.Environment;
13 | import android.view.Menu;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.view.View.OnClickListener;
17 | import android.widget.Button;
18 |
19 | public class MainActivity extends Activity {
20 | Button btn ;
21 | List orders = new ArrayList();
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_main);
26 |
27 | int length = Const.OrderInfo.orderOne.length;
28 | for(int i = 0;i < length;i++){
29 | Order order = new Order( Const.OrderInfo.orderOne[i][0], Const.OrderInfo.orderOne[i][1], Const.OrderInfo.orderOne[i][2], Const.OrderInfo.orderOne[i][3]);
30 | orders.add(order);
31 | }
32 | btn = (Button)super.findViewById(R.id.btn);
33 | btn.setOnClickListener(new OnClickListener() {
34 |
35 | @Override
36 | public void onClick(View v) {
37 | // TODO Auto-generated method stub
38 | try {
39 | ExcelUtil.writeExcel(MainActivity.this,
40 | orders, "excel_"+new Date().toString());
41 | } catch (Exception e) {
42 | // TODO Auto-generated catch block
43 | e.printStackTrace();
44 | }
45 |
46 | }
47 | });
48 | }
49 |
50 | @Override
51 | public boolean onCreateOptionsMenu(Menu menu) {
52 | // Inflate the menu; this adds items to the action bar if it is present.
53 | getMenuInflater().inflate(R.menu.main, menu);
54 | return true;
55 | }
56 |
57 | @Override
58 | public boolean onOptionsItemSelected(MenuItem item) {
59 | // Handle action bar item clicks here. The action bar will
60 | // automatically handle clicks on the Home/Up button, so long
61 | // as you specify a parent activity in AndroidManifest.xml.
62 | int id = item.getItemId();
63 | if (id == R.id.action_settings) {
64 | return true;
65 | }
66 | return super.onOptionsItemSelected(item);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/com/lxj/execldemo/ExcelUtil.java:
--------------------------------------------------------------------------------
1 | package com.lxj.execldemo;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.io.OutputStream;
6 | import java.util.List;
7 |
8 | import jxl.Workbook;
9 | import jxl.format.Colour;
10 | import jxl.write.Label;
11 | import jxl.write.WritableCellFormat;
12 | import jxl.write.WritableFont;
13 | import jxl.write.WritableSheet;
14 | import jxl.write.WritableWorkbook;
15 | import jxl.write.WriteException;
16 | import android.content.Context;
17 | import android.os.Environment;
18 | import android.os.StatFs;
19 | import android.provider.MediaStore.Audio.Media;
20 | import android.widget.Toast;
21 |
22 | public class ExcelUtil {
23 | //内存地址
24 | public static String root = Environment.getExternalStorageDirectory()
25 | .getPath();
26 |
27 | public static void writeExcel(Context context, List exportOrder,
28 | String fileName) throws Exception {
29 | if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)&&getAvailableStorage()>1000000) {
30 | Toast.makeText(context, "SD卡不可用", Toast.LENGTH_LONG).show();
31 | return;
32 | }
33 | String[] title = { "订单", "店名", "电话", "地址" };
34 | File file;
35 | File dir = new File(context.getExternalFilesDir(null).getPath());
36 | file = new File(dir, fileName + ".xls");
37 | if (!dir.exists()) {
38 | dir.mkdirs();
39 | }
40 | // 创建Excel工作表
41 | WritableWorkbook wwb;
42 | OutputStream os = new FileOutputStream(file);
43 | wwb = Workbook.createWorkbook(os);
44 | // 添加第一个工作表并设置第一个Sheet的名字
45 | WritableSheet sheet = wwb.createSheet("订单", 0);
46 | Label label;
47 | for (int i = 0; i < title.length; i++) {
48 | // Label(x,y,z) 代表单元格的第x+1列,第y+1行, 内容z
49 | // 在Label对象的子对象中指明单元格的位置和内容
50 | label = new Label(i, 0, title[i], getHeader());
51 | // 将定义好的单元格添加到工作表中
52 | sheet.addCell(label);
53 | }
54 |
55 | for (int i = 0; i < exportOrder.size(); i++) {
56 | Order order = exportOrder.get(i);
57 |
58 | Label orderNum = new Label(0, i + 1, order.id);
59 | Label restaurant = new Label(1, i + 1, order.restName);
60 | Label nameLabel = new Label(2,i+1,order.restPhone);
61 | Label address = new Label(3, i + 1, order.receiverAddr);
62 |
63 | sheet.addCell(orderNum);
64 | sheet.addCell(restaurant);
65 | sheet.addCell(nameLabel);
66 | sheet.addCell(address);
67 | Toast.makeText(context, "写入成功", Toast.LENGTH_LONG).show();
68 |
69 | }
70 | // 写入数据
71 | wwb.write();
72 | // 关闭文件
73 | wwb.close();
74 | }
75 |
76 | public static WritableCellFormat getHeader() {
77 | WritableFont font = new WritableFont(WritableFont.TIMES, 10,
78 | WritableFont.BOLD);// 定义字体
79 | try {
80 | font.setColour(Colour.BLUE);// 蓝色字体
81 | } catch (WriteException e1) {
82 | e1.printStackTrace();
83 | }
84 | WritableCellFormat format = new WritableCellFormat(font);
85 | try {
86 | format.setAlignment(jxl.format.Alignment.CENTRE);// 左右居中
87 | format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 上下居中
88 | // format.setBorder(Border.ALL, BorderLineStyle.THIN,
89 | // Colour.BLACK);// 黑色边框
90 | // format.setBackground(Colour.YELLOW);// 黄色背景
91 | } catch (WriteException e) {
92 | e.printStackTrace();
93 | }
94 | return format;
95 | }
96 |
97 | /** 获取SD可用容量 */
98 | private static long getAvailableStorage() {
99 |
100 | StatFs statFs = new StatFs(root);
101 | long blockSize = statFs.getBlockSize();
102 | long availableBlocks = statFs.getAvailableBlocks();
103 | long availableSize = blockSize * availableBlocks;
104 | // Formatter.formatFileSize(context, availableSize);
105 | return availableSize;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android_Excel
2 | 在android中生成excel
3 | ##效果图
4 | 
5 | ##初始化数据
6 | 首先我们要先造下测试数据,这里我把数据写死在一个常量类Const中,如下:
7 |
8 | ```
9 | public class Const {
10 | public interface OrderInfo{
11 | public static final String[][] orderOne = new String[][] {{ "123", "九龙", "13294352311",
12 | "武汉市关山口" },{ "124", "咱家", "13294352312",
13 | "武汉市水果湖" },{ "125", "陈家", "13294352315",
14 | "武汉市华师" },{ "126", "李", "13294352316",
15 | "武汉市杨家湾" }};
16 | }
17 | }
18 | ```
19 | 理论上这些数据是从后台读过来的。
20 | 本文模拟打印订单的信息,所以这里还需要一个订单Model类:
21 |
22 | ```
23 | public class Order implements Serializable {
24 |
25 | public String id;
26 |
27 | public String restPhone;
28 |
29 | public String restName;
30 |
31 | public String receiverAddr;
32 |
33 |
34 | public Order(String id,String restPhone, String restName, String receiverAddr) {
35 | this.id = id;
36 | this.restPhone = restPhone;
37 | this.restName = restName;
38 |
39 | this.receiverAddr = receiverAddr;
40 | }
41 | }
42 | ```
43 |
44 | ##存内存卡
45 | 接下来我们要判断一下内存卡是否存在,内存是否足够大。先获取指定目录下内存的大小:
46 |
47 | ```
48 | /** 获取SD可用容量 */
49 | private static long getAvailableStorage(Context context) {
50 | String root = context.getExternalFilesDir(null).getPath();
51 | StatFs statFs = new StatFs(root);
52 | long blockSize = statFs.getBlockSize();
53 | long availableBlocks = statFs.getAvailableBlocks();
54 | long availableSize = blockSize * availableBlocks;
55 | // Formatter.formatFileSize(context, availableSize);
56 | return availableSize;
57 | }
58 | ```
59 | 这里用到的路径是getExternalFilesDir,它指定的是SDCard/Android/data/你的应用的包名/files/ 目录这个目录,它用来放一些长时间保存的数据,当应用被卸载时,会同时会删除。类似这种情况的还有getExternalCacheDir方法,只是它一般用来存放临时文件。之后通过StatFs来计算出可用容量的大小。
60 | 接下来在写入excel前对内存进行判断,如下:
61 |
62 | ```
63 | if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)&&getAvailableStorage()>1000000) {
64 | Toast.makeText(context, "SD卡不可用", Toast.LENGTH_LONG).show();
65 | return;
66 | }
67 | File file;
68 | File dir = new File(context.getExternalFilesDir(null).getPath());
69 | file = new File(dir, fileName + ".xls");
70 | if (!dir.exists()) {
71 | dir.mkdirs();
72 | }
73 | ```
74 | 如果内存卡不存在或内存小于1M,不进行写入,然后创建相应的文件夹并起名字。接下来重点看下如何写入excel。
75 | ##生成写入excel
76 |
77 | - 导入相关包
78 | 这里需要导入jxl包,它主要就是用于处理excel的,这个包我会附在项目放在github中,后面会给出链接。
79 | - 生成excel工作表
80 | 以下代码是在指定路径下生成excel表,此时只是一个空表。
81 |
82 |
83 | ```
84 | WritableWorkbook wwb;
85 | OutputStream os = new FileOutputStream(file);
86 | wwb = Workbook.createWorkbook(os);
87 | ```
88 |
89 | - 添加sheet表
90 | 熟悉excel操作的都知道excel可以新建很多个sheet表。以下代码生成第一个工作表,名字为“订单”:
91 |
92 |
93 | ```
94 | WritableSheet sheet = wwb.createSheet("订单", 0);
95 | ```
96 |
97 | - 添加excel表头
98 | 添加excel的表头,这里可以自定义表头的样式,先看代码:
99 |
100 |
101 | ```
102 | String[] title = { "订单", "店名", "电话", "地址" };
103 | Label label;
104 | for (int i = 0; i < title.length; i++) {
105 | // Label(x,y,z) 代表单元格的第x+1列,第y+1行, 内容z
106 | // 在Label对象的子对象中指明单元格的位置和内容
107 | label = new Label(i, 0, title[i], getHeader());
108 | // 将定义好的单元格添加到工作表中
109 | sheet.addCell(label);
110 | }
111 | ```
112 | 这里表头信息我写死了。表的一个单元格对应一个Label,如label(0,0,"a")代表第一行第一列所在的单元格信息为a。getHeader()是自定义的样式,它返回一个 WritableCellFormat 。来看看如何自定义样式:
113 |
114 |
115 | ```
116 | public static WritableCellFormat getHeader() {
117 | WritableFont font = new WritableFont(WritableFont.TIMES, 10,
118 | WritableFont.BOLD);// 定义字体
119 | try {
120 | font.setColour(Colour.BLUE);// 蓝色字体
121 | } catch (WriteException e1) {
122 | e1.printStackTrace();
123 | }
124 | WritableCellFormat format = new WritableCellFormat(font);
125 | try {
126 | format.setAlignment(jxl.format.Alignment.CENTRE);// 左右居中
127 | format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 上下居中
128 | format.setBorder(Border.ALL, BorderLineStyle.THIN,
129 | Colour.BLACK);// 黑色边框
130 | format.setBackground(Colour.YELLOW);// 黄色背景
131 | } catch (WriteException e) {
132 | e.printStackTrace();
133 | }
134 | return format;
135 | }
136 | ```
137 | 看上面代码就很清楚了,通过获得WritableFont 来自定义字体的一些样式,如颜色大小等,通过WritableCellFormat 来设置文本框的样式,可以设置边框底色等。具体的可以查api文档,这里只给出例子。
138 |
139 | - 添加excel内容。
140 |
141 |
142 | ```
143 | for (int i = 0; i < exportOrder.size(); i++) {
144 | Order order = exportOrder.get(i);
145 |
146 | Label orderNum = new Label(0, i + 1, order.id);
147 | Label restaurant = new Label(1, i + 1, order.restName);
148 | Label nameLabel = new Label(2,i+1,order.restPhone);
149 | Label address = new Label(3, i + 1, order.receiverAddr);
150 |
151 | sheet.addCell(orderNum);
152 | sheet.addCell(restaurant);
153 | sheet.addCell(nameLabel);
154 | sheet.addCell(address);
155 | Toast.makeText(context, "写入成功", Toast.LENGTH_LONG).show();
156 |
157 | }
158 | ```
159 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------