Demonstrates how to insert cols/rows
()
| 398 | |
| 399 | // Demonstrates how to insert cols/rows |
| 400 | func Example_insert() { |
| 401 | xl, err := xlsx.Open("./test_files/example_simple.xlsx") |
| 402 | if err != nil { |
| 403 | log.Fatal(err) |
| 404 | } |
| 405 | |
| 406 | defer xl.Close() |
| 407 | |
| 408 | sheet := xl.Sheet(0) |
| 409 | |
| 410 | fmt.Println(sheet.Dimension()) |
| 411 | fmt.Println(strings.Join(sheet.Col(3).Values(), ",")) |
| 412 | |
| 413 | // Insert a new col |
| 414 | sheet.InsertCol(3) |
| 415 | fmt.Println(sheet.Dimension()) |
| 416 | fmt.Println(strings.Join(sheet.Col(3).Values(), ",")) |
| 417 | fmt.Println(strings.Join(sheet.Col(4).Values(), ",")) |
| 418 | |
| 419 | // Insert a new row |
| 420 | fmt.Println(strings.Join(sheet.Row(9).Values(), ",")) |
| 421 | sheet.InsertRow(3) |
| 422 | fmt.Println(sheet.Dimension()) |
| 423 | fmt.Println(strings.Join(sheet.Row(9).Values(), ",")) |
| 424 | fmt.Println(strings.Join(sheet.Row(10).Values(), ",")) |
| 425 | |
| 426 | //Output: |
| 427 | // 14 28 |
| 428 | // ,,,,,,,,,1,6,11,16,,,,,,,,,,,,,,, |
| 429 | // 15 28 |
| 430 | // ,,,,,,,,,,,,,,,,,,,,,,,,,,, |
| 431 | // ,,,,,,,,,1,6,11,16,,,,,,,,,,,,,,, |
| 432 | // ,,,,1,2,3,4,5,,,,,, |
| 433 | // 15 29 |
| 434 | // ,,,,,,,,,,,,,, |
| 435 | // ,,,,1,2,3,4,5,,,,,, |
| 436 | } |
| 437 | |
| 438 | // Demonstrates how to delete information |
| 439 | func Example_delete() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…