تحديد الأرقام المهمة التي سيتم تخزينها في ملف Excel
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
بشكل افتراضي ، يخزن Aspose.Cells 17 رقمًا مهمًا من القيم المزدوجة داخل ملف Excel ، على عكس MS-Excel الذي يخزن فقط 15 رقمًا مهمًا. يمكنك تغيير السلوك الافتراضي لـ Aspose.Cells من 17 خانة مميزة إلى 15 رقمًا مميزًا باستخدامCellsHelper.SignificantDigitsخاصية.
تحديد الارقام المهمة التي سيتم تخزينها في ملف اكسل
يفرض نموذج التعليمات البرمجية التالي Aspose.Cells لاستخدام 15 رقمًا مهمًا أثناء تخزين قيم مزدوجة داخل ملف Excel. رجاء تاكد منملف اكسل الناتج . قم بتغيير امتداده إلى .zip وفك ضغطه وسترى ، يتم تخزين 15 رقمًا مهمًا فقط داخل ملف Excel. توضح لقطة الشاشة التالية تأثيرCellsHelper.SignificantDigitsالخاصية على ملف الإخراج إكسل.
عينة من الرموز
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
//By default, Aspose.Cells stores 17 significant digits unlike | |
//MS-Excel which stores only 15 significant digits | |
CellsHelper.SignificantDigits = 15; | |
//Create workbook | |
Workbook workbook = new Workbook(); | |
//Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
//Access cell A1 | |
Cell c = worksheet.Cells["A1"]; | |
//Put double value, only 15 significant digits as specified by | |
//CellsHelper.SignificantDigits above will be stored in excel file just like MS-Excel does | |
c.PutValue(1234567890.123451711); | |
//Save the workbook | |
workbook.Save(dataDir + "out_SignificantDigits.xlsx"); |