Çalışma Sayfasında Köprüleri Yönetme
Köprü Ekleme
Aspose.Cells.GridDesktop kullanarak bir hücreye köprü eklemek için lütfen aşağıdaki adımları izleyin:
- Aspose.Cells.GridDesktop kontrolünü ekleyin.Biçim
- İstediğiniz herhangi birine erişinÇalışma kağıdı
- İstenilen erişimCell köprülenecek çalışma sayfasında
- Köprülenecek hücreye bir miktar değer ekleyin
- Eklemekköprü köprünün uygulanacağı hücre adını belirterek çalışma sayfasına
köprüler koleksiyonundaÇalışma kağıdı nesne aşırı yükleme sağlarEklemek yöntem. Geliştiriciler, herhangi bir aşırı yüklenmiş sürümünü kullanabilirEklemek özel ihtiyaçlarına göre yöntem.
Aşağıdaki kod, bir köprü ekleyecektirB2 veC3 çalışma sayfasının hücreleri.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing first worksheet of the Grid | |
Worksheet sheet = gridDesktop1.Worksheets[0]; | |
// Accessing cell of the worksheet | |
GridCell cell = sheet.Cells["b2"]; | |
GridCell cell2 = sheet.Cells["c3"]; | |
// Modifying the width of the column of the cell | |
sheet.Columns[cell.Column].Width = 160; | |
sheet.Columns[cell2.Column].Width = 160; | |
// Adding a value to the cell | |
cell.Value = "Aspose Home"; | |
cell2.Value = "Aspose Home"; | |
// Adding a hyperlink to the worksheet containing cell name and the hyperlink URL with which the cell will be linked | |
sheet.Hyperlinks.Add("b2", "www.aspose.com"); | |
sheet.Hyperlinks.Add("c3", "www.aspose.com"); |
Köprülere Erişim
Bir hücreye köprü eklendiğinde, çalışma zamanında köprüye erişmek ve köprüyü değiştirmek de gerekebilir. Bunu yapmak için, geliştiriciler köprüye yalnızcaköprüler koleksiyonuÇalışma kağıdı köprünün eklendiği hücreyi belirterek (hücre adını veya satır ve sütun numarası cinsinden konumunu kullanarak). Köprüye erişildikten sonra, geliştiriciler çalışma zamanında URL’sini değiştirebilir.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing first worksheet of the Grid | |
Worksheet sheet = gridDesktop1.Worksheets[0]; | |
// Accessing a hyperlink added to "c3,b2" cells (specified using its row & column number) | |
Aspose.Cells.GridDesktop.Data.GridHyperlink hyperlink1 = sheet.Hyperlinks[2, 2]; | |
Aspose.Cells.GridDesktop.Data.GridHyperlink hyperlink2 = sheet.Hyperlinks[1, 1]; | |
if (hyperlink1 != null && hyperlink2 != null) | |
{ | |
// Modifying the Url of the hyperlink | |
hyperlink1.Url = "www.aspose.com"; | |
hyperlink2.Url = "www.aspose.com"; | |
MessageBox.Show("Hyperlinks are accessed and URL's are: \n" + hyperlink1.Url + "\n" + hyperlink2.Url); | |
} | |
else | |
{ | |
MessageBox.Show("No hyperlinks are found in sheet. Add hyperlinks first."); | |
} |
Köprüleri Kaldırma
Mevcut bir köprüyü kaldırmak için, geliştiriciler basitçe istenen bir çalışma sayfasına erişebilir ve ardındanKaldırmak gelen köprüköprüler koleksiyonuÇalışma kağıdı köprülü hücreyi belirterek (adını veya satır ve sütun numarasını kullanarak).
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing first worksheet of the Grid | |
Worksheet sheet = gridDesktop1.Worksheets[0]; | |
if (sheet.Hyperlinks.Count > 0) | |
{ | |
// Removing hyperlink from "c3" cell | |
sheet.Hyperlinks.Remove(2, 2); | |
MessageBox.Show("Hyperlink in C3 cell has been removed."); | |
} | |
else | |
{ | |
MessageBox.Show("No hyperlinks are found in sheet to remove. Add hyperlinks first."); | |
} |