Ottieni intervallo di celle con C++
Contents
[
Hide
]
Possibili Scenari di Utilizzo
Quando hai bisogno solo di manipolare alcuni dati nel foglio di lavoro, è necessario conoscere l’intervallo dei dati dell’intero foglio di lavoro. Aspose.Cells offre questa funzionalità. Aspose.Cells fornisce le seguenti proprietà e metodi per aiutarti a raggiungere i tuoi obiettivi.
- Cells.GetMaxDisplayRange()
- Cells.GetMaxRow()
- Cells.GetMaxDataRow()
- Cells.GetMaxColumn()
- Cells.GetMaxDataColumn()
Ottieni l’intervallo delle celle utilizzando Aspose.Cells
Questo esempio mostra come:
- Crea un libro di lavoro.
- Aggiungi dati alle celle nel primo foglio di lavoro.
- Ottieni celle Range.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main() {
Aspose::Cells::Startup();
Workbook workbook;
Worksheet ws = workbook.GetWorksheets().Get(0);
Cells cells = ws.GetCells();
Cell cell = cells.Get(u"A1");
cell.PutValue(u"Fruit");
cell = cells.Get(u"B1");
cell.PutValue(u"Count");
cell = cells.Get(u"C1");
cell.PutValue(u"Price");
cell = cells.Get(u"A2");
cell.PutValue(u"Apple");
cell = cells.Get(u"A3");
cell.PutValue(u"Mango");
cell = cells.Get(u"A4");
cell.PutValue(u"Blackberry");
cell = cells.Get(u"A5");
cell.PutValue(u"Cherry");
cell = cells.Get(u"B2");
cell.PutValue(5);
cell = cells.Get(u"B3");
cell.PutValue(3);
cell = cells.Get(u"B4");
cell.PutValue(6);
cell = cells.Get(u"B5");
cell.PutValue(4);
cell = cells.Get(u"C2");
cell.PutValue(5);
cell = cells.Get(u"C3");
cell.PutValue(20);
cell = cells.Get(u"C4");
cell.PutValue(30);
cell = cells.Get(u"C5");
cell.PutValue(60);
cell = cells.Get(u"E10");
Style temp = workbook.CreateStyle();
temp.GetFont().SetColor(Color::Red());
cell.SetStyle(temp);
Range range = cells.GetMaxDisplayRange();
std::cout << cells.GetMaxRow() << std::endl;
std::cout << cells.GetMaxDataRow() << std::endl;
std::cout << cells.GetMaxColumn() << std::endl;
std::cout << cells.GetMaxDataColumn() << std::endl;
Aspose::Cells::Cleanup();
return 0;
}