تنسيق علامات الوسم الذكي

نسخ سمة الأعمدة

في بعض الأحيان، عند استخدام العلامات الذكية، ترغب في نسخ النمط للخلية التي تحتوي على علامات الوسم الذكي. يمكنك استخدام سمة النسخ لعلامات الوسم الذكي لهذا الغرض.

نسخ الأنماط من الخلايا مع الوسوم الذكية

يستخدم هذا المثال ملف قالب Microsoft Excel بسيط مع علامتين في الخلايا A2 و B2. تستخدم العلامة الموضوعة في الخلية B2 سمة النسخ النمطية، بينما العلامة في الخلية A2 لا تفعل ذلك. قم بتطبيق تنسيق بسيط (على سبيل المثال، ضبط لون الخط إلى أحمر وتعيين لون ملء الخلية إلى أصفر).

يستخدم هذا المثال ملف القالب بعض الوسوم في الخلايا. عند تنفيذ الكود، تقوم Aspose.Cells بنسخ التنسيق إلى جميع السجلات في العمود B ولكن لا تحتفظ بالتنسيق في العمود A.

public class CopyStyleData
{
private int year;
private String date;
public CopyStyleData(int year, String date)
{
this.year = year;
this.date = date;
}
public int getYear()
{
return year;
}
public void setYear(int year)
{
this.year = year;
}
public String getDate()
{
return date;
}
public void setDate(String date)
{
this.date = date;
}
}
List<CopyStyleData> dataList = new ArrayList<>();
dataList.add(new CopyStyleData(2010, "13/9/2010"));
dataList.add(new CopyStyleData(2010, "14/9/2010"));
dataList.add(new CopyStyleData(2009, "13/9/2009"));
dataList.add(new CopyStyleData(2009, "14/9/2009"));
dataList.add(new CopyStyleData(2009, "15/9/2009"));
dataList.add(new CopyStyleData(2010, "13/9/2010"));
dataList.add(new CopyStyleData(2010, "14/9/2010"));
dataList.add(new CopyStyleData(2010, "15/9/2010"));
dataList.add(new CopyStyleData(2009, "13/9/2009"));
dataList.add(new CopyStyleData(2009, "14/9/2009"));
// Instantiate the workbook from a template file that contains Smart Markers
Workbook book = new Workbook("template1.xlsx");
// Instantiate a new WorkbookDesigner
WorkbookDesigner designer = new WorkbookDesigner();
// Specify the workbook to the designer book
designer.setWorkbook(book);
// Set the data source
designer.setDataSource("DataList", dataList);
// Process the smart markers
designer.process(false);
// Save the Excel file
book.save("output_java.xlsx", SaveFormat.XLSX);

إضافة تسميات مخصصة

مقدمة

أثناء العمل مع ميزة تجميع بيانات العلامات الذكية، في بعض الأحيان تحتاج إلى إضافة التسميات المخصصة الخاصة بك إلى الصف الحاصل. كما ترغب في دمج اسم العمود مع تلك التسمية، على سبيل المثال “المجموع الفرعي للطلبات”. توفر Aspose.Cells لك سمة العلامة وموقع العلامة، حتى يمكنك وضع التسميات المخصصة الخاصة بك في العلامات الذكية أثناء الدمج مع صفوف الإجمالي.

إضافة تسميات مخصصة للدمج مع صفوف الإجمالي في العلامات الذكية

يستخدم هذا المثال ملف القالب ببعض الوسوم في الخلايا. عند تنفيذ الكود، يقوم Aspose.Cells بإضافة بعض التسميات المخصصة إلى الصفوف الحاصلة لبيانات المجموع.

public class Report
{
private int year;
private String date;
private String assetClass;
private int reportedCost;
private int assessedValue;
public Report(int year, String date, String assetClass, int reportedCost, int assessedValue)
{
this.year = year;
this.date = date;
this.assetClass = assetClass;
this.reportedCost = reportedCost;
this.assessedValue = assessedValue;
}
public int getYear()
{
return year;
}
public void setYear(int year)
{
this.year = year;
}
public String getDate()
{
return date;
}
public void setDate(String date)
{
this.date = date;
}
public String getAssetClass()
{
return assetClass;
}
public void setAssetClass(String assetClass)
{
this.assetClass = assetClass;
}
public int getReportedCost()
{
return reportedCost;
}
public void setReportedCost(int reportedCost)
{
this.reportedCost = reportedCost;
}
public int getAssessedValue()
{
return assessedValue;
}
public void setAssessedValue(int assessedValue)
{
this.assessedValue = assessedValue;
}
}
List<Report> reportList = new ArrayList<>();
reportList.add(new Report(2010, "13/9/2010", "Fast Food Equipment", 400,160));
reportList.add(new Report(2010, "14/9/2010", "Fast Food Equipment", 800,1280));
reportList.add(new Report(2009, "13/9/2009", "Fast Food Equipment", 300, 90));
reportList.add(new Report(2009, "14/9/2009", "Fast Food Equipment", 600, 720));
reportList.add(new Report(2009, "15/9/2009", "Fast Food Equipment", 900, 2430));
reportList.add(new Report(2010, "13/9/2010", "Inventory", 100, 10));
reportList.add(new Report(2010, "14/9/2010", "Inventory", 200, 80));
reportList.add(new Report(2010, "15/9/2010", "Inventory", 300, 270));
reportList.add(new Report(2009, "13/9/2009", "Inventory", 200, 40));
reportList.add(new Report(2009, "14/9/2009", "Inventory", 400, 320));
// Instantiate the workbook from a template file that contains Smart Markers
Workbook book = new Workbook("template.xlsx");
// Instantiate a new WorkbookDesigner
WorkbookDesigner designer = new WorkbookDesigner();
// Specify the workbook to the designer book
designer.setWorkbook(book);
// Set the data source
designer.setDataSource("Report", reportList);
// Process the smart markers
designer.process();
// Save the Excel file
book.save("output_java.xlsx", SaveFormat.XLSX);