تحديد الارقام المهمة التي سيتم تخزينها في ملف اكسل
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
بشكل افتراضي ، يقوم Aspose.Cells بتخزين 17 رقمًا مهمًا من القيم المزدوجة في جداول البيانات بخلاف تطبيق Excel الذي يخزن فقط 15 رقمًا مهمًا. يمكنك تغيير السلوك الافتراضي Aspose.Cells لهذه الحالة ، أي ؛ يمكنك تغيير عدد الأرقام المعنوية من 17 إلى 15 أثناء استخدامCellsHelper.SignificantDigitsخاصية.
تحديد الارقام المهمة التي سيتم تخزينها في ملف اكسل
يفرض نموذج التعليمات البرمجية التالي Aspose.Cells لاستخدام 15 رقمًا مهمًا أثناء تخزين قيم مزدوجة داخل ملف Excel. رجاء تاكد منملف اكسل الناتج . قم بتغيير امتداده إلى .zip وفك ضغطه وسترى ، يتم تخزين 15 رقمًا مهمًا فقط داخل ملف Excel. توضح لقطة الشاشة التالية تأثيرCellsHelper.SignificantDigitsالخاصية على ملف الإخراج إكسل.
عينة من الرموز
This file contains hidden or 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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(SignificantDigits.class) + "CellsHelperClass/"; | |
//By default, Aspose.Cells stores 17 significant digits unlike | |
//MS-Excel which stores only 15 significant digits | |
CellsHelper.setSignificantDigits(15); | |
//Create workbook | |
Workbook workbook = new Workbook(); | |
//Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
//Access cell A1 | |
Cell c = worksheet.getCells().get("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"); |