Skip to content

Commit 9f878b8

Browse files
committed
[Bug] Fixed system does not support IEnumerable<MiniWordHyperLink> (#39 via @isdaniel)
1 parent 68a0f92 commit 9f878b8

8 files changed

Lines changed: 20 additions & 214 deletions

File tree

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
112112

113113
##### Template
114114

115-
![image](https://user-images.githubusercontent.com/12729184/190647953-6f9da393-e666-4658-a56d-b3a7f13c0ea1.png)
115+
![image](C:\Users\Wei\Downloads\190647953-6f9da393-e666-4658-a56d-b3a7f13c0ea1.png)
116116

117117
##### Result
118118

119-
![image](https://user-images.githubusercontent.com/12729184/190648179-30258d82-723d-4266-b711-43f132d1842d.png)
119+
![image](C:\Users\Wei\Downloads\190648179-30258d82-723d-4266-b711-43f132d1842d.png)
120120

121121
### List
122122

@@ -135,11 +135,11 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
135135

136136
Template
137137

138-
![image](https://user-images.githubusercontent.com/12729184/190645513-230c54f3-d38f-47af-b844-0c8c1eff2f52.png)
138+
![image](C:\Users\Wei\Downloads\190645513-230c54f3-d38f-47af-b844-0c8c1eff2f52.png)
139139

140140
##### Result
141141

142-
![image](https://user-images.githubusercontent.com/12729184/190645704-1f6405e9-71e3-45b9-aa99-2ba52e5e1519.png)
142+
![image](C:\Users\Wei\Downloads\190645704-1f6405e9-71e3-45b9-aa99-2ba52e5e1519.png)
143143

144144
### Table
145145

@@ -173,12 +173,12 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
173173

174174
##### Template
175175

176-
![image](https://user-images.githubusercontent.com/12729184/190843632-05bb6459-f1c1-4bdc-a79b-54889afdfeea.png)
176+
![image](C:\Users\Wei\Downloads\190843632-05bb6459-f1c1-4bdc-a79b-54889afdfeea.png)
177177

178178

179179
##### Result
180180

181-
![image](https://user-images.githubusercontent.com/12729184/190843663-c00baf16-21f2-4579-9d08-996a2c8c549b.png)
181+
![image](C:\Users\Wei\Downloads\190843663-c00baf16-21f2-4579-9d08-996a2c8c549b.png)
182182

183183

184184

@@ -352,10 +352,3 @@ public class ApiController : Controller
352352

353353

354354

355-
## Questions
356-
357-
### {{Tag}} doesn't work
358-
359-
Suggest to recopy and paste `{{tag}}` , sometime type tag in word`{{}}`will split to `<w:t>{</w:t><w:t>{<w:/t><w:t>Tag</w:t><w:t>}</w:t><w:t>}<w:/t>` like image:
360-
361-
![image](https://user-images.githubusercontent.com/12729184/190683025-fbf1bfa3-a34a-4af9-a8d3-30c6807d229c.png)

README.zh-CN.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,20 +355,12 @@ public class ApiController : Controller
355355

356356

357357

358-
## 支持我 : [Donate Link](https://miniexcel.github.io/)
358+
## 支持 : [Donate Link](https://miniexcel.github.io/)
359359

360360
<a href="https://user-images.githubusercontent.com/12729184/158003727-ca348041-5e59-44bc-a694-f400777e0252.jpg"><img src="https://user-images.githubusercontent.com/12729184/158003727-ca348041-5e59-44bc-a694-f400777e0252.jpg" alt="wechat" width="200px" height="300px">
361361
</a>
362362
<a href="https://user-images.githubusercontent.com/12729184/158003731-6d132872-19c3-4840-b1af-97aa22f9bf4b.jpg">
363363
<img src="https://user-images.githubusercontent.com/12729184/158003731-6d132872-19c3-4840-b1af-97aa22f9bf4b.jpg" alt="alipay" width="200px" height="300px"></a>
364364

365-
## 常见问题
366-
367-
### 模版字串没有生效
368-
369-
建议 `{{tag}}` 复制重新整串复制贴上,有时打字 word 在底层 `{{}}`会被切开变成`<w:t>{</w:t><w:t>{<w:/t><w:t>Tag</w:t><w:t>}</w:t><w:t>}<w:/t>` 如图片
370-
371-
![image](https://user-images.githubusercontent.com/12729184/190683025-fbf1bfa3-a34a-4af9-a8d3-30c6807d229c.png)
372-
373365

374366

README.zh-Hant.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
MiniWord .NET Word模板引擎,藉由Word模板和數據簡單、快速生成文件。
2727

28-
![image](https://user-images.githubusercontent.com/12729184/190835307-6cd87982-b5f3-4a79-9682-bdd1cc02a4ea.png)
28+
![image](C:\Users\Wei\Downloads\190835307-6cd87982-b5f3-4a79-9682-bdd1cc02a4ea.png)
2929

3030

3131

@@ -90,11 +90,11 @@ MiniWord.SaveAsByTemplate(path, templatePath, value);
9090

9191
##### 模版
9292

93-
![image](https://user-images.githubusercontent.com/12729184/190834360-39b4b799-d523-4b7e-9331-047a61fd5eb9.png)
93+
![image](C:\Users\Wei\Downloads\190834360-39b4b799-d523-4b7e-9331-047a61fd5eb9.png)
9494

9595
##### 導出
9696

97-
![image](https://user-images.githubusercontent.com/12729184/190834455-ba065211-0f9d-41d1-9b7a-5d9e96ac2eff.png)
97+
![image](C:\Users\Wei\Downloads\190834455-ba065211-0f9d-41d1-9b7a-5d9e96ac2eff.png)
9898

9999

100100

@@ -351,7 +351,7 @@ public class ApiController : Controller
351351

352352

353353

354-
## 支持我 : [Donate Link](https://miniexcel.github.io/)
354+
## 支持 : [Donate Link](https://miniexcel.github.io/)
355355

356356
<a href="https://user-images.githubusercontent.com/12729184/158003727-ca348041-5e59-44bc-a694-f400777e0252.jpg"><img src="https://user-images.githubusercontent.com/12729184/158003727-ca348041-5e59-44bc-a694-f400777e0252.jpg" alt="wechat" width="200px" height="300px">
357357
</a>
@@ -360,10 +360,3 @@ public class ApiController : Controller
360360

361361

362362

363-
## 常見問題
364-
365-
### 模版字串沒有生效
366-
367-
建議 `{{tag}}` 複製重新整串複製貼上,有時打字 word 在底層 `{{}}` 會被切開變成 `<w:t>{</w:t><w:t>{<w:/t><w:t>Tag</w:t><w:t>}</w:t><w:t>}<w:/t>` 如圖片
368-
369-
![image](https://user-images.githubusercontent.com/12729184/190683025-fbf1bfa3-a34a-4af9-a8d3-30c6807d229c.png)

release-note/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525

2626

27+
### 0.6.1
28+
- [Bug] Fixed system does not support `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
29+
2730
### 0.6.0
2831
- [New] Support hyperLink (#33 via @isdaniel)
2932
- [New] Support custom font color and highlight color (#35 via impPDX)

release-note/README.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
---
2424

25+
### 0.6.1
26+
- [Bug] 修正系统不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
2527

2628
### 0.6.0
2729
- [New] 支持 hyperLink (#33 via @isdaniel)

release-note/README.zh-Hant.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
---
2424

25-
25+
### 0.6.1
26+
- [Bug] 修正系統不支持 `IEnumerable<MiniWordHyperLink>` (#39 via @isdaniel)
2627

2728
### 0.6.0
2829
- [New] 支持 hyperLink (#33 via @isdaniel)

src/MiniWord/Extensions/OpenXmlExtension.cs

Lines changed: 0 additions & 163 deletions
This file was deleted.

src/MiniWord/MiniWord.Implment.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using DocumentFormat.OpenXml;
44
using DocumentFormat.OpenXml.Packaging;
55
using DocumentFormat.OpenXml.Wordprocessing;
6-
using MiniSoftware.Extensions;
76
using MiniSoftware.Utility;
87
using System;
98
using System.Collections;
@@ -42,8 +41,8 @@ private static void SaveAsByTemplateImpl(Stream stream, byte[] template, Diction
4241
}
4342
private static void Generate(this OpenXmlElement xmlElement, WordprocessingDocument docx, Dictionary<string, object> tags)
4443
{
45-
// avoid {{tag}} like <t>abs{</t><t>{</t>
46-
AvoidSplitTagText(xmlElement, tags.Select(o => "{{" + o.Key + "}}"));
44+
// avoid {{tag}} like <t>{</t><t>{</t>
45+
AvoidSplitTagText(xmlElement);
4746

4847
//Tables
4948
var tables = xmlElement.Descendants<Table>().ToArray();
@@ -145,20 +144,6 @@ private static void AvoidSplitTagText(OpenXmlElement xmlElement)
145144
}
146145
}
147146

148-
private static void AvoidSplitTagText(OpenXmlElement xmlElement, IEnumerable<string> txt)
149-
{
150-
foreach (var paragraph in xmlElement.Elements<Paragraph>())
151-
{
152-
foreach (var continuousString in paragraph.GetContinuousString())
153-
{
154-
foreach (var text in txt.Where(o => continuousString.Item1.Contains(o)))
155-
{
156-
continuousString.Item3.TrimStringToInContinuousString(text);
157-
}
158-
}
159-
}
160-
}
161-
162147
private static void ReplaceText(OpenXmlElement xmlElement, WordprocessingDocument docx, Dictionary<string, object> tags)
163148
{
164149
var paragraphs = xmlElement.Descendants<Paragraph>().ToArray();

0 commit comments

Comments
 (0)