Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
06c2d40c
Commit
06c2d40c
authored
Jun 17, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打印模板处理
parent
c0ec8f1e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
459 additions
and
0 deletions
+459
-0
ContentAlignment.java
...ava/com/yanzuoguang/util/printer/vo/ContentAlignment.java
+61
-0
PrinterPagerData.java
...ava/com/yanzuoguang/util/printer/vo/PrinterPagerData.java
+172
-0
PrinterPagerItemData.java
...com/yanzuoguang/util/printer/vo/PrinterPagerItemData.java
+187
-0
PrinterPagerItemType.java
...com/yanzuoguang/util/printer/vo/PrinterPagerItemType.java
+39
-0
No files found.
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/ContentAlignment.java
0 → 100644
View file @
06c2d40c
package
com
.
yanzuoguang
.
util
.
printer
.
vo
;
/**
* 对其方式
*
* @author 颜佐光
*/
public
class
ContentAlignment
{
/**
* 摘要:
* Content is vertically aligned at the top, and horizontally aligned on the left.
*/
public
static
int
TopLeft
=
1
;
/**
* 摘要:
* Content is vertically aligned at the top, and horizontally aligned at the center.
*/
public
static
int
TopCenter
=
2
;
/**
* 摘要:
* Content is vertically aligned at the top, and horizontally aligned on the rig
*/
public
static
int
TopRight
=
4
;
/**
* <p>
* 摘要:
* Content is vertically aligned in the middle, and horizontally aligned on the
* left.
*/
public
static
int
MiddleLeft
=
16
;
/**
* 摘要:
* Content is vertically aligned in the middle, and horizontally aligned at the
* center.
*/
public
static
int
MiddleCenter
=
32
;
/**
* 摘要:
* Content is vertically aligned in the middle, and horizontally aligned on the
* right.
*/
public
static
int
MiddleRight
=
64
;
/**
* 摘要:
* Content is vertically aligned at the bottom, and horizontally aligned on the
* left.
*/
public
static
int
BottomLeft
=
256
;
/**
* 摘要:
* Content is vertically aligned at the bottom, and horizontally aligned at the
* center.
*/
public
static
int
BottomCenter
=
512
;
/**
* 摘要:
* Content is vertically aligned at the bottom, and horizontally aligned on the
* right.
*/
public
static
int
BottomRight
=
1024
;
}
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/PrinterPagerData.java
0 → 100644
View file @
06c2d40c
package
com
.
yanzuoguang
.
util
.
printer
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 本实体用于C#,所以需要属性首字母大写,不能将其转换为字段
*
* @author 颜佐光
*/
public
class
PrinterPagerData
extends
BaseVo
{
/**
* 纸张宽度
*/
@JSONField
(
name
=
"PageWidth"
)
private
double
pageWidth
;
/**
* 纸张高度
*/
@JSONField
(
name
=
"PageWidth"
)
private
double
pageHeight
;
/**
* 左边边距
*/
@JSONField
(
name
=
"PageWidth"
)
private
double
marginLeft
;
/**
* 上边边距
*/
@JSONField
(
name
=
"PageWidth"
)
private
double
marginTop
;
/// 右边边距
@JSONField
(
name
=
"PageWidth"
)
private
double
marginRight
;
/// 下边边距
@JSONField
(
name
=
"PageWidth"
)
private
double
marginBottom
;
/**
* 打印角度
*/
@JSONField
(
name
=
"PageWidth"
)
private
float
printAngle
;
/**
* 所有页面需要打印得属性
*/
@JSONField
(
name
=
"PageWidth"
)
private
List
<
PrinterPagerItemData
>
items
;
/**
* 构造函数
*/
public
PrinterPagerData
()
{
this
.
pageWidth
=
180
;
this
.
pageHeight
=
100
;
this
.
marginLeft
=
0
;
this
.
marginTop
=
0
;
this
.
marginRight
=
0
;
this
.
marginBottom
=
0
;
this
.
printAngle
=
0
;
this
.
items
=
new
ArrayList
<>();
}
/**
* 清除位置
*/
private
void
ClearPosition
()
{
this
.
items
.
clear
();
}
/**
* 复制当前配置到新对象
*
* @param to 复制到得对象
*/
public
void
CopyTo
(
PrinterPagerData
to
)
{
to
.
pageWidth
=
this
.
pageWidth
;
to
.
pageHeight
=
this
.
pageHeight
;
to
.
marginLeft
=
this
.
marginLeft
;
to
.
marginTop
=
this
.
marginTop
;
to
.
marginRight
=
this
.
marginRight
;
to
.
marginBottom
=
this
.
marginBottom
;
to
.
printAngle
=
this
.
printAngle
;
to
.
items
.
clear
();
for
(
PrinterPagerItemData
item
:
this
.
items
)
{
PrinterPagerItemData
item_to
=
new
PrinterPagerItemData
();
item
.
copyTo
(
item_to
);
to
.
items
.
add
(
item_to
);
}
}
public
double
getPageWidth
()
{
return
pageWidth
;
}
public
void
setPageWidth
(
double
pageWidth
)
{
this
.
pageWidth
=
pageWidth
;
}
public
double
getPageHeight
()
{
return
pageHeight
;
}
public
void
setPageHeight
(
double
pageHeight
)
{
this
.
pageHeight
=
pageHeight
;
}
public
double
getMarginLeft
()
{
return
marginLeft
;
}
public
void
setMarginLeft
(
double
marginLeft
)
{
this
.
marginLeft
=
marginLeft
;
}
public
double
getMarginTop
()
{
return
marginTop
;
}
public
void
setMarginTop
(
double
marginTop
)
{
this
.
marginTop
=
marginTop
;
}
public
double
getMarginRight
()
{
return
marginRight
;
}
public
void
setMarginRight
(
double
marginRight
)
{
this
.
marginRight
=
marginRight
;
}
public
double
getMarginBottom
()
{
return
marginBottom
;
}
public
void
setMarginBottom
(
double
marginBottom
)
{
this
.
marginBottom
=
marginBottom
;
}
public
float
getPrintAngle
()
{
return
printAngle
;
}
public
void
setPrintAngle
(
float
printAngle
)
{
this
.
printAngle
=
printAngle
;
}
public
List
<
PrinterPagerItemData
>
getItems
()
{
return
items
;
}
public
void
setItems
(
List
<
PrinterPagerItemData
>
items
)
{
this
.
items
=
items
;
}
}
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/PrinterPagerItemData.java
0 → 100644
View file @
06c2d40c
package
com
.
yanzuoguang
.
util
.
printer
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.BaseVo
;
/**
* 打印项
*
* @author 颜佐光
*/
public
class
PrinterPagerItemData
extends
BaseVo
{
/**
* 名称,用于识别
*/
@JSONField
(
name
=
"Name"
)
public
String
name
;
/**
* 是否图片,打印项类型:PrinterPagerItemType
*/
@JSONField
(
name
=
"Type"
)
public
int
type
;
/**
* 是否显示
*/
@JSONField
(
name
=
"IsVisible"
)
public
boolean
isVisible
;
/**
* 左边距离
*/
@JSONField
(
name
=
"Left"
)
public
double
left
;
/**
* 上面距离
*/
@JSONField
(
name
=
"Top"
)
public
double
top
;
/**
* 宽度
*/
@JSONField
(
name
=
"Width"
)
public
double
width
;
/**
* 高度
*/
@JSONField
(
name
=
"Height"
)
public
double
height
;
/**
* 字体名称
*/
@JSONField
(
name
=
"Font"
)
public
String
font
;
/**
* 对齐方式,参见类:ContentAlignment
*/
@JSONField
(
name
=
"TextAlign"
)
public
int
textAlign
;
/**
* 格式化
*/
@JSONField
(
name
=
"Format"
)
public
String
format
;
/**
* 构造函数
*/
public
PrinterPagerItemData
()
{
this
.
name
=
StringHelper
.
EMPTY
;
this
.
type
=
PrinterPagerItemType
.
None
;
this
.
isVisible
=
true
;
this
.
left
=
0
;
this
.
top
=
0
;
this
.
width
=
100
;
this
.
height
=
20
;
this
.
font
=
"微软雅黑,9pt,style=Bold"
;
this
.
format
=
StringHelper
.
EMPTY
;
this
.
textAlign
=
ContentAlignment
.
TopLeft
;
}
/**
* 复制到新属性
*
* @param to
*/
public
void
copyTo
(
PrinterPagerItemData
to
)
{
to
.
name
=
this
.
name
;
to
.
type
=
this
.
type
;
to
.
isVisible
=
this
.
isVisible
;
to
.
left
=
this
.
left
;
to
.
top
=
this
.
top
;
to
.
width
=
this
.
width
;
to
.
height
=
this
.
height
;
to
.
format
=
this
.
format
;
to
.
font
=
this
.
font
;
to
.
textAlign
=
this
.
textAlign
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
int
getType
()
{
return
type
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
boolean
isVisible
()
{
return
isVisible
;
}
public
void
setVisible
(
boolean
visible
)
{
isVisible
=
visible
;
}
public
double
getLeft
()
{
return
left
;
}
public
void
setLeft
(
double
left
)
{
this
.
left
=
left
;
}
public
double
getTop
()
{
return
top
;
}
public
void
setTop
(
double
top
)
{
this
.
top
=
top
;
}
public
double
getWidth
()
{
return
width
;
}
public
void
setWidth
(
double
width
)
{
this
.
width
=
width
;
}
public
double
getHeight
()
{
return
height
;
}
public
void
setHeight
(
double
height
)
{
this
.
height
=
height
;
}
public
String
getFont
()
{
return
font
;
}
public
void
setFont
(
String
font
)
{
this
.
font
=
font
;
}
public
int
getTextAlign
()
{
return
textAlign
;
}
public
void
setTextAlign
(
int
textAlign
)
{
this
.
textAlign
=
textAlign
;
}
public
String
getFormat
()
{
return
format
;
}
public
void
setFormat
(
String
format
)
{
this
.
format
=
format
;
}
}
yzg-util-print/src/main/java/com/yanzuoguang/util/printer/vo/PrinterPagerItemType.java
0 → 100644
View file @
06c2d40c
package
com
.
yanzuoguang
.
util
.
printer
.
vo
;
/**
* 打印项类型
*
* @author 颜佐光
*/
public
class
PrinterPagerItemType
{
/**
* 普通编辑文本
*/
public
static
int
None
=
0
;
/**
* 数据库字段
*/
public
static
int
Field
=
1
;
/**
* 图片
*/
public
static
int
Bmp
=
2
;
/**
* 线
*/
public
static
int
Line
=
3
;
/**
* 横线
*/
public
static
int
LineX
=
4
;
/**
* 竖线
*/
public
static
int
LineY
=
5
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment