|
@@ -270,9 +270,20 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
int wordNum = w / wordWidth - (w % wordWidth == 0 ? 0 : 1);
|
|
|
//int wordNum = w / wordWidth;
|
|
|
//需要几行
|
|
|
- int hang = userNameWidth / w + (userNameWidth % w == 0 ? 0 : 1);
|
|
|
- //int hang = content.length() / wordNum + (content.length() % wordNum == 0 ? 0 : 1);
|
|
|
+ String[] split = content.split("\n");
|
|
|
+ int hang = split.length;
|
|
|
for (int i = 0; i < hang; i++) {
|
|
|
+
|
|
|
+ String contentTemp = split[i];
|
|
|
+ //开始点位
|
|
|
+ int x_i = x;
|
|
|
+ //int y_i = y + userNameSize[1] * (i + 1);
|
|
|
+ int y_i = y + lineHeight1 * (i + 1);
|
|
|
+ g.drawString(contentTemp, x_i, y_i);
|
|
|
+ }
|
|
|
+ //int hang = userNameWidth / w + (userNameWidth % w == 0 ? 0 : 1);
|
|
|
+ //int hang = content.length() / wordNum + (content.length() % wordNum == 0 ? 0 : 1);
|
|
|
+ /*for (int i = 0; i < hang; i++) {
|
|
|
int temp = wordNum * (i + 1) > content.length() ? content.length() : wordNum * (i + 1);
|
|
|
if (temp > content.length()) temp = content.length();
|
|
|
if (wordNum * i > content.length()) continue;
|
|
@@ -282,7 +293,7 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
//int y_i = y + userNameSize[1] * (i + 1);
|
|
|
int y_i = y + lineHeight1 * (i + 1);
|
|
|
g.drawString(contentTemp, x_i, y_i);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|
|
|
String strFileName = StringProcessUtils.getStringRandom(8);
|
|
@@ -491,9 +502,19 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
int wordNum = w / wordWidth - (w % wordWidth == 0 ? 0 : 1);
|
|
|
//int wordNum = w / wordWidth;
|
|
|
//需要几行
|
|
|
- int hang = userNameWidth / w + (userNameWidth % w == 0 ? 0 : 1);
|
|
|
- //int hang = content.length() / wordNum + (content.length() % wordNum == 0 ? 0 : 1);
|
|
|
+ String[] split = content.split("\n");
|
|
|
+ int hang = split.length;
|
|
|
for (int i = 0; i < hang; i++) {
|
|
|
+
|
|
|
+ String contentTemp = split[i];
|
|
|
+ //开始点位
|
|
|
+ int x_i = x;
|
|
|
+ //int y_i = y + userNameSize[1] * (i + 1);
|
|
|
+ int y_i = y + lineHeight1 * (i + 1);
|
|
|
+ g.drawString(contentTemp, x_i, y_i);
|
|
|
+ }
|
|
|
+ //int hang = userNameWidth / w + (userNameWidth % w == 0 ? 0 : 1);
|
|
|
+ /*for (int i = 0; i < hang; i++) {
|
|
|
int temp = wordNum * (i + 1) > content.length() ? content.length() : wordNum * (i + 1);
|
|
|
if (temp > content.length()) temp = content.length();
|
|
|
if (wordNum * i > content.length()) continue;
|
|
@@ -503,7 +524,7 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
//int y_i = y + userNameSize[1] * (i + 1);
|
|
|
int y_i = y + lineHeight1 * (i + 1);
|
|
|
g.drawString(contentTemp, x_i, y_i);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|
|
|
String strFileName = StringProcessUtils.getStringRandom(8);
|