質問編集履歴
3
しmpぇ
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,45 +20,13 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
外部リンクはRelationshipに値を保持する。
|
24
|
-
|
25
|
-
リンクは、セルではなく、
|
26
|
-
|
27
|
-
C:\Excelリンクテスト\Link\xl\externalLinks\_rels\externalLink1.xml.rels
|
28
|
-
|
29
|
-
に値を保持。
|
30
24
|
|
31
25
|
|
32
26
|
|
33
|
-
|
27
|
+
(2)ClosedXML, EPPlusを使ってセルのValue, Fomulaを読んでみる。
|
34
28
|
|
35
|
-
|
36
|
-
|
37
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="Original.xlsx" TargetMode="External"/></Relationships>
|
38
|
-
|
39
|
-
```
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
となっている。
|
44
|
-
|
45
|
-
とすると、
|
46
|
-
|
47
|
-
Relationship
|
48
|
-
|
49
|
-
Id="rId1"
|
50
|
-
|
51
|
-
Target="Original.xlsx"
|
52
|
-
|
53
|
-
なので、XMLでRelationshopを探せばよさそう。
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
(3)ClosedXML, EPPlusを使ってセルのValue, Fomulaを読んでみる。
|
58
|
-
|
59
|
-
EPPlusでは該当のcellのFomulaは、"[1]Sheet1!$A$1"。とすると[1]を先のRelationshipで、rId1で引いてTargetのOriginal.xlsxに置き換えればよいか。
|
60
|
-
|
61
|
-
セルにはフルパスで書いたのに、相対パスになっているから、そこも直す必要あり。
|
29
|
+
EPPlusでは該当のcellのFomulaは、"[1]Sheet1!$A$1"。Original.xlsxがない。
|
62
30
|
|
63
31
|
|
64
32
|
|
@@ -88,8 +56,6 @@
|
|
88
56
|
|
89
57
|
{
|
90
58
|
|
91
|
-
//< Relationships xmlns = "http://schemas.openxmlformats.org/package/2006/relationships" >< Relationship Id = "rId1" Type = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target = "Original.xlsx" TargetMode = "External" /></ Relationships >
|
92
|
-
|
93
59
|
cell.Value = 500;//<=ここで一時停止していろいろ見てみるがRelationshopがない。
|
94
60
|
|
95
61
|
}
|
@@ -97,56 +63,6 @@
|
|
97
63
|
}
|
98
64
|
|
99
65
|
```
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
https://github.com/JanKallman/EPPlus
|
104
|
-
|
105
|
-
でEPPlusのソースを取得し、見たところ、
|
106
|
-
|
107
|
-
ExcelWorksheets.csの772行に、
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
```
|
112
|
-
|
113
|
-
string CreateWorkbookRel(string Name, int sheetID, Uri uriWorksheet, bool isChart)
|
114
|
-
|
115
|
-
{
|
116
|
-
|
117
|
-
//Create the relationship between the workbook and the new worksheet
|
118
|
-
|
119
|
-
var rel = _pck.Workbook.Part.CreateRelationship(UriHelper.GetRelativeUri(_pck.Workbook.WorkbookUri, uriWorksheet), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/" + (isChart ? "chartsheet" : "worksheet"));
|
120
|
-
|
121
|
-
_pck.Package.Flush();
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
//Create the new sheet node
|
126
|
-
|
127
|
-
XmlElement worksheetNode = _pck.Workbook.WorkbookXml.CreateElement("sheet", ExcelPackage.schemaMain);
|
128
|
-
|
129
|
-
worksheetNode.SetAttribute("name", Name);
|
130
|
-
|
131
|
-
worksheetNode.SetAttribute("sheetId", sheetID.ToString());
|
132
|
-
|
133
|
-
worksheetNode.SetAttribute("id", ExcelPackage.schemaRelationships, rel.Id);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
TopNode.AppendChild(worksheetNode);
|
138
|
-
|
139
|
-
return rel.Id;
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
```
|
146
|
-
|
147
|
-
というmethodを発見。これがpublicでないから使えないのでしょうか?
|
148
|
-
|
149
|
-
でもcreateでgetじゃないな。単に読むだけなら。。。
|
150
66
|
|
151
67
|
|
152
68
|
|
2
add
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,6 +100,58 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
+
https://github.com/JanKallman/EPPlus
|
104
|
+
|
105
|
+
でEPPlusのソースを取得し、見たところ、
|
106
|
+
|
107
|
+
ExcelWorksheets.csの772行に、
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
string CreateWorkbookRel(string Name, int sheetID, Uri uriWorksheet, bool isChart)
|
114
|
+
|
115
|
+
{
|
116
|
+
|
117
|
+
//Create the relationship between the workbook and the new worksheet
|
118
|
+
|
119
|
+
var rel = _pck.Workbook.Part.CreateRelationship(UriHelper.GetRelativeUri(_pck.Workbook.WorkbookUri, uriWorksheet), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/" + (isChart ? "chartsheet" : "worksheet"));
|
120
|
+
|
121
|
+
_pck.Package.Flush();
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
//Create the new sheet node
|
126
|
+
|
127
|
+
XmlElement worksheetNode = _pck.Workbook.WorkbookXml.CreateElement("sheet", ExcelPackage.schemaMain);
|
128
|
+
|
129
|
+
worksheetNode.SetAttribute("name", Name);
|
130
|
+
|
131
|
+
worksheetNode.SetAttribute("sheetId", sheetID.ToString());
|
132
|
+
|
133
|
+
worksheetNode.SetAttribute("id", ExcelPackage.schemaRelationships, rel.Id);
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
TopNode.AppendChild(worksheetNode);
|
138
|
+
|
139
|
+
return rel.Id;
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
```
|
146
|
+
|
147
|
+
というmethodを発見。これがpublicでないから使えないのでしょうか?
|
148
|
+
|
149
|
+
でもcreateでgetじゃないな。単に読むだけなら。。。
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
103
155
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
104
156
|
|
105
157
|
Microsoft Visual Studio Pro 2017
|
1
add
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,9 +30,13 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
+
```xml
|
34
|
+
|
33
35
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
34
36
|
|
35
37
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="Original.xlsx" TargetMode="External"/></Relationships>
|
38
|
+
|
39
|
+
```
|
36
40
|
|
37
41
|
|
38
42
|
|