قم بإنشاء ملف XBRL في C#

قم بإنشاء مثيل XBRL في C#

يدعم Aspose.Finance تكوين وثائق XBRL. لهذا ، يوفر API فئة XbrlDocument. المُنشئ الافتراضي لملفXbrl وثيقة يمكن استخدام الفئة لتكوين وثيقة نسخة جديدة XBRL.

يوضح مقتطف الكود التالي إنشاء مستند مثيل جديد XBRL.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
document.Save(XbrlFilePath + @"output\document1.xbrl");

أضف مرجع مخطط

يسمح لك Aspose.Finance بإضافة مرجع الوصف المنطقي في نسخة XBRL التي تم تكوينها حديثًا. لهذا ، يوفر API امتدادمجموعة المخططات صف دراسي.

يوضح مقتطف التعليمات البرمجية التالي إضافة مرجع مخطط إلى مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
SchemaRefCollection schemaRefs = xbrlInstance.SchemaRefs;
schemaRefs.Add(XbrlFilePath + @"schema.xsd", "example", "http://example.com/xbrl/taxonomy");
document.Save(XbrlFilePath + @"output\document2.xbrl");

أضف السياق

يسمح لك Aspose.Finance بإضافة سياق في نسخة XBRL المنشأة حديثًا. لهذا ، يوفر API امتدادسياقصف دراسي.

يوضح مقتطف التعليمات البرمجية التالي إضافة سياق في مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
ContextPeriod contextPeriod = new ContextPeriod(DateTime.Parse("2020-01-01"), DateTime.Parse("2020-02-10"));
ContextEntity contextEntity = new ContextEntity("exampleIdentifierScheme", "exampleIdentifier");
Context context = new Context(contextPeriod, contextEntity);
xbrlInstance.Contexts.Add(context);
document.Save(XbrlFilePath + @"output\document3.xbrl");

أضف وحدة

يسمح لك Aspose.Finance بإضافة سياق في نسخة XBRL المنشأة حديثًا. لهذا ، يوفر API امتدادوحدة صف دراسي.

يوضح مقتطف الشفرة التالي كيفية إضافة وحدة في مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
Unit unit = new Unit(UnitType.Measure);
unit.MeasureQualifiedNames.Add(new QualifiedName("USD", "iso4217", "http://www.xbrl.org/2003/iso4217"));
xbrlInstance.Units.Add(unit);
document.Save(XbrlFilePath + @"output\document4.xbrl");

اضافة عنصر

يسمح لك Aspose.Finance بإضافة بنود في نسخة XBRL التي تم تكوينها حديثًا. لهذا ، يوفر API امتدادالعنصر صف دراسي.

يوضح مقتطف التعليمات البرمجية التالي كيفية إضافة عنصر في مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
SchemaRefCollection schemaRefs = xbrlInstance.SchemaRefs;
schemaRefs.Add(XbrlFilePath + @"schema.xsd", "example", "http://example.com/xbrl/taxonomy");
SchemaRef schema = schemaRefs[0];
ContextPeriod contextPeriod = new ContextPeriod(DateTime.Parse("2020-01-01"), DateTime.Parse("2020-02-10"));
ContextEntity contextEntity = new ContextEntity("exampleIdentifierScheme", "exampleIdentifier");
Context context = new Context(contextPeriod, contextEntity);
xbrlInstance.Contexts.Add(context);
Unit unit = new Unit(UnitType.Measure);
unit.MeasureQualifiedNames.Add(new QualifiedName("USD", "iso4217", "http://www.xbrl.org/2003/iso4217"));
xbrlInstance.Units.Add(unit);
Concept fixedAssetsConcept = schema.GetConceptByName("fixedAssets");
if (fixedAssetsConcept != null)
{
Item item = new Item(fixedAssetsConcept);
item.ContextRef = context;
item.UnitRef = unit;
item.Precision = 4;
item.Value = "1444";
xbrlInstance.Facts.Add(item);
}
document.Save(XbrlFilePath + @"output\document5.xbrl");

إضافة ارتباط الحاشية السفلية

يسمح لك Aspose.Finance بإضافة ارتباط حاشية سفلية في نسخة XBRL المنشأة حديثًا. لهذا ، يوفر API امتدادحاشية سفليةصف دراسي.

يوضح مقتطف التعليمات البرمجية التالي كيفية إضافة ارتباط حاشية سفلية في مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
SchemaRefCollection schemaRefs = xbrlInstance.SchemaRefs;
schemaRefs.Add(XbrlFilePath + @"schema.xsd", "example", "http://example.com/xbrl/taxonomy");
SchemaRef schema = schemaRefs[0];
ContextPeriod contextPeriod = new ContextPeriod(DateTime.Parse("2020-01-01"), DateTime.Parse("2020-02-10"));
ContextEntity contextEntity = new ContextEntity("exampleIdentifierScheme", "exampleIdentifier");
Context context = new Context(contextPeriod, contextEntity);
context.Id = "cd1";
xbrlInstance.Contexts.Add(context);
FootnoteLink footnoteLink = new FootnoteLink();
Footnote footnote = new Footnote("footnote1");
footnote.Text = "Including the effects of the merger.";
Loc loc = new Loc("#cd1", "fact1");
FootnoteArc footnoteArc = new FootnoteArc(loc.Label, footnote.Label);
footnoteLink.Footnotes.Add(footnote);
footnoteLink.Locators.Add(loc);
footnoteLink.FootnoteArcs.Add(footnoteArc);
xbrlInstance.FootnoteLinks.Add(footnoteLink);
document.Save(XbrlFilePath + @"output\document6.xbrl");

أضف مرجع الدور

يسمح لك Aspose.Finance بإضافة مرجع دور في نسخة XBRL التي تم تكوينها حديثًا. لهذا ، يوفر API امتدادالدورصف دراسي.

يوضح مقتطف الشفرة التالي كيفية إضافة مرجع دور في مثيل XBRL تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
SchemaRefCollection schemaRefs = xbrlInstance.SchemaRefs;
schemaRefs.Add(XbrlFilePath + @"schema.xsd", "example", "http://example.com/xbrl/taxonomy");
SchemaRef schema = schemaRefs[0];
RoleType roleType = schema.GetRoleTypeByURI("http://abc.com/role/link1");
if (roleType != null)
{
RoleReference roleReference = new RoleReference(roleType);
xbrlInstance.RoleReferences.Add(roleReference);
}
document.Save(XbrlFilePath + @"output\document7.xbrl");

أضف مرجع دور القوس

يسمح لك Aspose.Finance بإضافة مرجع دور القوس في مثيل XBRL الذي تم إنشاؤه حديثًا. لهذا ، يوفر API امتدادأركول المرجعصف دراسي.

يوضح مقتطف التعليمات البرمجية التالي كيفية إضافة مرجع دور القوس في مثيل XBRL الذي تم إنشاؤه حديثًا.

XbrlDocument document = new XbrlDocument();
XbrlInstanceCollection xbrlInstances = document.XbrlInstances;
XbrlInstance xbrlInstance = xbrlInstances[xbrlInstances.Add()];
SchemaRefCollection schemaRefs = xbrlInstance.SchemaRefs;
schemaRefs.Add(XbrlFilePath + @"schema.xsd", "example", "http://example.com/xbrl/taxonomy");
SchemaRef schema = schemaRefs[0];
ArcroleType arcroleType = schema.GetArcroleTypeByURI("http://abc.com/arcrole/footnote-test");
if (arcroleType != null)
{
ArcroleReference arcroleReference = new ArcroleReference(arcroleType);
xbrlInstance.ArcroleReferences.Add(arcroleReference);
}
document.Save(XbrlFilePath + @"output\document8.xbrl");