Pubblico API Modifiche Aspose.Cells 8.3.1

API aggiunte

Proprietà DataLabels.ShowCellRange Aggiunta

La proprietà ShowCellRange è stata aggiunta alla classe DataLabels per imitare la funzionalità di Excel di formattazione delle etichette dati del grafico in fase di esecuzione. Si prega di notare che Excel fornisce questa funzione attraverso i seguenti passaggi.

  1. Seleziona Etichette dati della serie e fai clic con il pulsante destro del mouse per aprire il menu a comparsa.
  2. Clicca ilFormato etichette dati… e lo mostreràOpzioni etichetta.
  3. Selezionare o deselezionare la casella di controlloL’etichetta contiene - Valore da Cells.

Il codice di esempio riportato di seguito accede alle etichette dei dati della serie di grafici e quindi imposta il metodo DataLabels.ShowCellRange su true per imitare la funzionalità di Excel diL’etichetta contiene - Valore da Cells.

C#

 //Create workbook from the source Excel file

Workbook workbook = new Workbook("sample.xlsx");

//Access the first worksheet

Worksheet worksheet = workbook.Worksheets[0];

//Access the chart inside the worksheet

Chart chart = worksheet.Charts[0];

//Check the "Label Contains - Value From Cells"

DataLabels dataLabels = chart.NSeries[0].DataLabels;

dataLabels.ShowCellRange = true;

//Save the workbook

workbook.Save("output.xlsx");

VB.NET

'Create workbook from the source Excel file

Dim m_workbook As Workbook = New Workbook("sample.xlsx")

'Access the first worksheet

Dim m_worksheet As Worksheet = m_workbook.Worksheets(0)

'Access the chart inside the worksheet

Dim m_chart As Chart = m_worksheet.Charts(0)

'Check the "Label Contains - Value From Cells"

Dim m_dataLabels As DataLabels = m_chart.NSeries(0).DataLabels

m_dataLabels.ShowCellRange = True

'Save the workbook

m_workbook.Save("output.xlsx")

Metodi Cell.GetTable e ListObject.PutCellValue aggiunti

metodi Cell.GetTable & ListObject.PutCellValue sono stati aggiunti con Aspose.Cells for .NET 8.3.1 per facilitare agli utenti l’accesso al ListObject da una cella e l’aggiunta di valori al suo interno utilizzando gli offset di riga e colonna. Il codice di esempio seguente carica il foglio di calcolo di origine e aggiunge i valori all’interno della tabella.

C#

 //Create workbook from source Excel file

Workbook workbook = new Workbook("source.xlsx");

//Access first worksheet

Worksheet worksheet = workbook.Worksheets[0];

//Access cell D5 which lies inside the table

Cell cell = worksheet.Cells["D5"];

//Put value inside the cell D5

cell.PutValue("D5 Data");

//Access the Table from this cell

ListObject table = cell.GetTable();

//Add some value using Row and Column Offset

table.PutCellValue(2, 2, "Offset [2,2]");

//Save the workbook

workbook.Save("output.xlsx");

VB.NET

 'Create workbook from source Excel file

Dim m_workbook As Workbook = New Workbook("source.xlsx")

'Access first worksheet

Dim m_worksheet As Worksheet = m_workbook.Worksheets(0)

'Access cell D5 which lies inside the table

Dim m_cell As Cell = m_worksheet.Cells("D5")

'Put value inside the cell D5

m_cell.PutValue("D5 Data")

'Access the Table from this cell

Dim table As ListObject = m_cell.GetTable()

'Add some value using Row and Column Offset

table.PutCellValue(2, 2, "Offset [2,2]")

'Save the workbook

m_workbook.Save("output.xlsx")

Proprietà OdsSaveOptions.IsStrictSchema11 Aggiunta

La proprietà IsStrictSchema11 è stata aggiunta alla classe OdsSaveOptions per consentire agli sviluppatori di salvare il foglio di calcolo in formato conforme alla specifica ODF v1.2. Il valore predefinito della proprietà IsStrictSchema11 è false, significa che dalla versione 8.3.1 delle API Aspose.Cells i file ODS verranno salvati come formato ODF versione 1.2 per impostazione predefinita.

Il frammento di codice fornito di seguito salva il file ODS in formato ODF 1.2.

C#

 //Create workbook

Workbook workbook = new Workbook();

//Access first worksheet

Worksheet worksheet = workbook.Worksheets[0];

//Put some value in cell A1

Cell cell = worksheet.Cells["A1"];

cell.PutValue("Welcome to Aspose!");

//Save ODS in ODF 1.2 version which is default

OdsSaveOptions options = new OdsSaveOptions();

workbook.Save("ODF1.2.ods", options);

//Save ODS in ODF 1.1 version

options.IsStrictSchema11 = true;

workbook.Save("ODF1.1.ods", options);

VB.NET

 'Create workbook 

Dim m_workbook As Workbook = New Workbook()

'Access first worksheet

Dim m_worksheet As Worksheet = m_workbook.Worksheets(0)

'Put some value in cell A1

Dim m_cell As Cell = m_worksheet.Cells("A1")

m_cell.PutValue("Welcome to Aspose!")

'Save ODS in ODF 1.2 version which is default

Dim options As OdsSaveOptions = New OdsSaveOptions()

m_workbook.Save("ODF1.2.ods", options)

'Save ODS in ODF 1.1 version

options.IsStrictSchema11 = True

m_workbook.Save("ODF1.1.ods", options)

Metodo SparklineCollection.Add Aggiunto

Aspose.Cells Le API hanno esposto il metodo SparklineCollection.Add(string dataRange, int row, int column) per specificare l’intervallo di dati e la posizione del gruppo Sparkline. Si noti che Excel fornisce la stessa funzionalità attraverso i seguenti passaggi.

  1. Seleziona la cella contenente il tuo Sparkline.
  2. SelezionareModifica i dati dalla sparkline sezione all’interno delDesign scheda
  3. ScegliereModifica la posizione e i dati del gruppo.
  4. SpecificareIntervallo di dati & Posizione.

Il seguente codice di esempio carica il foglio di calcolo di origine, accede al primo gruppo sparkline e aggiunge nuovi intervalli di dati e posizioni per il gruppo sparkline.

C#

 //Create workbook from source Excel file

Workbook workbook = new Workbook("source.xlsx");

//Access first worksheet

Worksheet worksheet = workbook.Worksheets[0];

//Access the first sparkline group

SparklineGroup group = worksheet.SparklineGroupCollection[0];

//Add Data Ranges and Locations inside this sparkline group

group.SparklineCollection.Add("D5:O5", 4, 15);

group.SparklineCollection.Add("D6:O6", 5, 15);

group.SparklineCollection.Add("D7:O7", 6, 15);

group.SparklineCollection.Add("D8:O8", 7, 15);

//Save the workbook

workbook.Save("output.xlsx");

VB.NET

 'Create workbook from source Excel file

Dim m_workbook As Workbook = New Workbook("source.xlsx")

'Access first worksheet

Dim m_worksheet As Worksheet = m_workbook.Worksheets(0)

'Access the first sparkline group

Dim group As SparklineGroup = m_worksheet.SparklineGroupCollection(0)

'Add Data Ranges and Locations inside this sparkline group

group.SparklineCollection.Add("D5:O5", 4, 15)

group.SparklineCollection.Add("D6:O6", 5, 15)

group.SparklineCollection.Add("D7:O7", 6, 15)

group.SparklineCollection.Add("D8:O8", 7, 15)

'Save the workbook

m_workbook.Save("output.xlsx")