Skip to content

Commit 81dc2a0

Browse files
authored
Create index.html
1 parent 922e32a commit 81dc2a0

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

index.html

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>GridXcel App</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
margin: 0;
11+
padding: 0;
12+
display: flex;
13+
justify-content: center;
14+
align-items: center;
15+
height: 100vh;
16+
background-color: #f5f5f5;
17+
}
18+
19+
table {
20+
border-collapse: collapse;
21+
width: 90%;
22+
overflow-x: auto;
23+
}
24+
25+
td, th {
26+
width: 50px;
27+
height: 30px;
28+
border: 1px solid #ccc;
29+
text-align: center;
30+
vertical-align: middle;
31+
cursor: pointer;
32+
background-color: #fff;
33+
}
34+
35+
input {
36+
width: 100%;
37+
height: 100%;
38+
border: none;
39+
text-align: center;
40+
background-color: transparent;
41+
}
42+
43+
.selected {
44+
background-color: #d0e0f0;
45+
}
46+
</style>
47+
</head>
48+
<body>
49+
<table id="excelTable">
50+
<!-- Table will be dynamically populated by JavaScript -->
51+
</table>
52+
53+
<script>
54+
const rows = 5000; // Adjust the rows to a manageable number for testing
55+
const cols = 3000; // Adjust the columns to a manageable number for testing
56+
const table = document.getElementById('excelTable');
57+
58+
// Initialize table
59+
for (let i = 0; i < rows; i++) {
60+
const row = table.insertRow();
61+
for (let j = 0; j < cols; j++) {
62+
const cell = row.insertCell();
63+
const input = document.createElement('input');
64+
input.type = 'text';
65+
input.id = `cell-${i}-${j}`;
66+
input.addEventListener('input', updateFormula);
67+
cell.appendChild(input);
68+
}
69+
}
70+
71+
// Handle formulas and update cell values
72+
function updateFormula(event) {
73+
const input = event.target;
74+
const [_, row, col] = input.id.split('-').map(Number);
75+
let value = input.value.trim();
76+
77+
// Simple formula parsing (for demonstration)
78+
if (value.startsWith('=') && value.length > 1) {
79+
value = parseFormula(value.slice(1), row, col);
80+
input.value = value;
81+
}
82+
83+
// Simulate some basic formulas
84+
function parseFormula(formula, row, col) {
85+
const match = formula.match(/([A-Z]+)(\d+)/);
86+
if (match) {
87+
const formulaRow = parseInt(match[2]) - 1;
88+
const formulaCol = match[1].charCodeAt(0) - 65;
89+
const targetCell = document.getElementById(`cell-${formulaRow}-${formulaCol}`);
90+
return targetCell ? targetCell.value : '';
91+
}
92+
return value;
93+
}
94+
}
95+
96+
// Example of adding simple formula parsing for SUM
97+
function addFormula(row, col) {
98+
// Add formula handling logic here (e.g., SUM, AVERAGE, etc.)
99+
}
100+
</script>
101+
</body>
102+
</html>

0 commit comments

Comments
 (0)