Satırları Sütunları ve Kaydırma Çubuklarını Göster ve Gizle
Satır ve Sütunları Göster ve Gizle
Aspose.Cells for Python via .NET, Workbook sınıfını sağlar; bu sınıf, bir Excel dosyasını temsil eder. Workbook sınıfı, gelişticilerin Excel dosyasındaki her çalışma sayfasına erişmesini sağlayan worksheets koleksiyonunu içerir.
Satır ve Sütunları Göster
Geliştiriciler, Cells koleksiyonunun sırasıyla unhide_row ve unhide_column metodlarını çağırarak gizlenen herhangi bir satır veya sütunu gösterebilirler. Her iki metod da iki parametre alır:
- Satır veya sütun dizini - belirli bir satır veya sütunun gösterilmesi için kullanılan dizin.
- Satır yüksekliği veya sütun genişliği - gizlendikten sonra atanan satır yüksekliği veya sütun genişliği.
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Creating a file stream containing the Excel file to be opened | |
fstream = open(dataDir + "book1.xls", "rb") | |
# Instantiating a Workbook object | |
# Opening the Excel file through the file stream | |
workbook = Workbook(fstream) | |
# Accessing the first worksheet in the Excel file | |
worksheet = workbook.worksheets[0] | |
# Unhiding the 3rd row and setting its height to 13.5 | |
worksheet.cells.unhide_row(2, 13.5) | |
# Unhiding the 2nd column and setting its width to 8.5 | |
worksheet.cells.unhide_column(1, 8.5) | |
# Saving the modified Excel file | |
workbook.save(dataDir + "output.xls") | |
# Closing the file stream to free all resources | |
fstream.close() |
Satır ve Sütunları Gizle
Geliştiriciler, Cells koleksiyonunun sırasıyla hide_row ve hide_column metodlarını çağırarak bir satır veya sütunu gizleyebilirler. Her iki metod da belirli satır veya sütunu gizlemek için satır veya sütun dizinini parametre olarak alır.
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Creating a file stream containing the Excel file to be opened | |
fstream = open(dataDir + "book1.xls", "rb") | |
# Instantiating a Workbook object | |
# Opening the Excel file through the file stream | |
workbook = Workbook(fstream) | |
# Accessing the first worksheet in the Excel file | |
worksheet = workbook.worksheets[0] | |
# Hiding the 3rd row of the worksheet | |
worksheet.cells.hide_row(2) | |
# Hiding the 2nd column of the worksheet | |
worksheet.cells.hide_column(1) | |
# Saving the modified Excel file | |
workbook.save(dataDir + "output.out.xls") | |
# Closing the file stream to free all resources | |
fstream.close() |
Birden Fazla Satır ve Sütunu Gizleme
Geliştiriciler, Cells koleksiyonunun sırasıyla hide_rows ve hide_columns metodlarını çağırarak bir defada birden fazla satır veya sütunu gizleyebilirler. Her iki metod da gizlenmesi gereken başlangıç satırı veya sütunu dizini ve gizlenmesi gereken satır veya sütun sayısını parametre olarak alır.
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Creating a file stream containing the Excel file to be opened | |
fstream = open(dataDir + "book1.xls", "rb") | |
# Instantiating a Workbook object | |
# Opening the Excel file through the file stream | |
workbook = Workbook(fstream) | |
# Accessing the first worksheet in the Excel file | |
worksheet = workbook.worksheets[0] | |
# Hiding 3,4 and 5 rows in the worksheet | |
worksheet.cells.hide_rows(2, 3) | |
# Hiding 2 and 3 columns in the worksheet | |
worksheet.cells.hide_columns(1, 2) | |
# Saving the modified Excel file | |
workbook.save(dataDir + "outputxls") | |
# Closing the file stream to free all resources | |
fstream.close() |
Kaydırma Çubuklarını Göster ve Gizle
Kaydırma çubukları, herhangi bir dosyanın içeriğini gezinmek için kullanılır. Genellikle iki tür kaydırma çubuğu bulunur:
- Dikey kaydırma çubukları
- Yatay kaydırma çubukları
Microsoft Excel ayrıca, kullanıcıların çalışma sayfası içeriğinde kaydırma yapabilmesi için yatay ve dikey kaydırıcılar sağlar. Aspose.Cells for Python via .NET kullanarak, geliştiriciler her iki kaydırıcı türünün görünürlüğünü kontrol edebilirler.
Kaydırma Çubuklarının Görünürlüğünü Kontrol Etmek
Aspose.Cells for Python via .NET, Workbook adlı bir sınıf sağlar ve bu sınıf, bir Excel dosyasını temsil eder. Workbook sınıfı, bir Excel dosyasını yönetmek için geniş özellik ve yöntemler sunar. Kaydırıcıların görünürlüğünü kontrol etmek için, Workbook sınıfının WorkbookSettings.is_v_scroll_bar_visible ve WorkbookSettings.is_h_scroll_bar_visible özelliklerini kullanın. WorkbookSettings.is_v_scroll_bar_visible ve WorkbookSettings.is_h_scroll_bar_visible Boolean özellikleridir ve sadece doğru veya yanlış değerleri depolayabilirler.
Kaydırma Çubuklarını Görünür Yapma
Kaydırma çubuklarını görünür yapmak için Workbook sınıfının WorkbookSettings.is_v_scroll_bar_visible veya WorkbookSettings.is_h_scroll_bar_visible özelliğini true olarak ayarlayın.
Kaydırma çubuklarını gizleme
Kaydırma çubuklarını gizlemek için Workbook sınıfının WorkbookSettings.is_v_scroll_bar_visible veya WorkbookSettings.is_h_scroll_bar_visible özelliğini false olarak ayarlayın.
Örnek Kod
Aşağıda, bir Excel dosyasını, book1.xls’yi açan, her iki kaydırma çubuğunu gizleyen ve ardından değiştirilmiş dosyayı output.xls olarak kaydeden tam bir kod bulunmaktadır.
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Creating a file stream containing the Excel file to be opened | |
fstream = open(dataDir + "book1.xls", "rb") | |
# Instantiating a Workbook object | |
# Opening the Excel file through the file stream | |
workbook = Workbook(fstream) | |
# Hiding the vertical scroll bar of the Excel file | |
workbook.settings.is_v_scroll_bar_visible = False | |
# Hiding the horizontal scroll bar of the Excel file | |
workbook.settings.is_h_scroll_bar_visible = False | |
# Saving the modified Excel file | |
workbook.save(dataDir + "output.xls") | |
# Closing the file stream to free all resources | |
fstream.close() |