質問編集履歴
3
ソース追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,8 +36,67 @@
|
|
36
36
|
import 'package:cross_file/cross_file.dart';
|
37
37
|
import 'package:path/path.dart';
|
38
38
|
|
39
|
+
|
40
|
+
void main() {
|
41
|
+
runApp(const MyApp());
|
42
|
+
}
|
43
|
+
|
44
|
+
class MyApp extends StatelessWidget {
|
45
|
+
const MyApp({Key? key}) : super(key: key);
|
46
|
+
|
47
|
+
@override
|
48
|
+
Widget build(BuildContext context) {
|
49
|
+
return MaterialApp(
|
50
|
+
debugShowCheckedModeBanner: false,
|
51
|
+
home: Scaffold(
|
52
|
+
endDrawer: Drawer(
|
53
|
+
child: ListView.builder(
|
54
|
+
itemCount: 5,
|
55
|
+
itemBuilder: (BuildContext context, int index) {
|
56
|
+
return ListTile(
|
57
|
+
title: Text("Item $index"),
|
58
|
+
);
|
59
|
+
},
|
60
|
+
),
|
61
|
+
),
|
62
|
+
appBar: AppBar(
|
63
|
+
title: const Text('ドキュメント変換ツール(仮)'),
|
64
|
+
),
|
65
|
+
body: Center(
|
66
|
+
child: Container(
|
67
|
+
child: Column(
|
68
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
69
|
+
children: <Widget>[
|
39
|
-
|
70
|
+
Wrap(
|
71
|
+
direction: Axis.horizontal,
|
72
|
+
runSpacing: 8,
|
73
|
+
spacing: 8,
|
74
|
+
children: const [ExmapleDragTarget()],
|
75
|
+
),
|
76
|
+
],
|
77
|
+
),
|
78
|
+
),
|
79
|
+
)
|
80
|
+
));
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
class ExmapleDragTarget extends StatefulWidget {
|
85
|
+
const ExmapleDragTarget({Key? key}) : super(key: key);
|
86
|
+
|
87
|
+
@override
|
88
|
+
_ExmapleDragTargetState createState() => _ExmapleDragTargetState();
|
89
|
+
}
|
90
|
+
|
91
|
+
class _ExmapleDragTargetState extends State<ExmapleDragTarget> {
|
92
|
+
final List<XFile> _list = [];
|
93
|
+
|
94
|
+
bool _dragging = false;
|
95
|
+
|
96
|
+
Offset? offset;
|
97
|
+
|
40
98
|
// ファイルをドロップするエリアの実装
|
99
|
+
@override
|
41
100
|
Widget build(BuildContext context) {
|
42
101
|
return DropTarget(
|
43
102
|
onDragDone: (detail) async {
|
@@ -60,8 +119,17 @@
|
|
60
119
|
bytes = File(file.path).readAsBytesSync();
|
61
120
|
var excel = Excel.decodeBytes(bytes);
|
62
121
|
|
122
|
+
// 行ごとのループ
|
123
|
+
for (var i = 0; i < excel.tables['Sheet1']!.rows.length; i++) {
|
124
|
+
var rowData = excel.tables['Sheet1']!.rows[i];
|
125
|
+
// 列ごとのループ
|
126
|
+
for (var j = 0; j < rowData.length; j++) {
|
127
|
+
Data? data = rowData[j];
|
128
|
+
if (data != null) {
|
129
|
+
debugPrint(data.value); // 表示確認用
|
63
|
-
|
130
|
+
}
|
64
|
-
|
131
|
+
}
|
132
|
+
}
|
65
133
|
}
|
66
134
|
}
|
67
135
|
}
|
2
画像追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
Flutterでデスクトップアプリを作っています。
|
4
4
|
Excelファイルをアプリ画面にドラッグ&ドロップし、別フォーマットのExcelファイルに置き換えて出力します。
|
5
|
+
|
6
|
+

|
7
|
+

|
5
8
|
|
6
9
|
### 実現したいこと
|
7
10
|
- [ ] 元のExcelファイルの各セルの文字列は同じまま、別フォーマットのExcelファイルに置き換えて出力したい
|
1
ソース修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -57,7 +57,12 @@
|
|
57
57
|
bytes = File(file.path).readAsBytesSync();
|
58
58
|
var excel = Excel.decodeBytes(bytes);
|
59
59
|
|
60
|
-
(
|
60
|
+
(中略)
|
61
|
+
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
61
66
|
|
62
67
|
```
|
63
68
|
|