Class TableCell

TableCell class

टेबल सेल का प्रतिनिधित्व करता है।

public sealed class TableCell : CompositeNode<IOutlineChildNode>

कंस्ट्रक्टर्स

नामविवरण
TableCell()का एक नया उदाहरण प्रारंभ करता हैTableCell वर्ग.

गुण

नामविवरण
BackgroundColor { get; set; }पृष्ठभूमि का रंग प्राप्त या सेट करता है।
Document { get; }नोड का दस्तावेज़ प्राप्त करता है।
FirstChild { get; }
IsComposite { get; }
LastChild { get; }
LastModifiedTime { get; set; }अंतिम संशोधित समय प्राप्त या सेट करता है।
MaxWidth { get; }अधिकतम चौड़ाई प्राप्त करता है।
NextSibling { get; }उसी नोड ट्री स्तर पर अगला नोड प्राप्त करता है।
NodeType { get; }नोड प्रकार प्राप्त करता है।
ParentNode { get; }मूल नोड प्राप्त करता है।
PreviousSibling { get; }पिछले नोड को उसी नोड ट्री स्तर पर प्राप्त करता है।

तरीकों

नामविवरण
override Accept(DocumentVisitor)नोड के आगंतुक को स्वीकार करता है।
virtual AppendChildFirst<T1>(T1)
virtual AppendChildLast<T1>(T1)
override GetChildNodes<T1>()
GetEnumerator()
virtual InsertChild<T1>(int, T1)
InsertChildrenRange(int, IEnumerable<IOutlineChildNode>)
InsertChildrenRange(int, params IOutlineChildNode[])
RemoveChild<T1>(T1)

उदाहरण

टेबल के सेल से टेक्स्ट प्राप्त करने का तरीका दिखाता है।

// दस्तावेज़ निर्देशिका का पथ।
string dataDir = RunExamples.GetDataDir_Tables();

// दस्तावेज़ को Aspose.Note में लोड करें।
Document document = new Document(dataDir + "Sample1.one");

// टेबल नोड्स की सूची प्राप्त करें
IList<Table> nodes = document.GetChildNodes<Table>();        

foreach (Table table in nodes)
{
    // तालिका पंक्तियों के माध्यम से पुनरावृति करें
    foreach (TableRow row in table)
    {
        // टेबलसेल नोड्स की सूची प्राप्त करें
        // तालिका कक्षों के माध्यम से पुनरावृति करें
        foreach (TableCell cell in row)
        {
            // पाठ पुनर्प्राप्त करें
            string text = string.Join(Environment.NewLine, cell.GetChildNodes<RichText>().Select(e => e.Text)) + Environment.NewLine;

            // आउटपुट स्क्रीन पर टेक्स्ट प्रिंट करें
            Console.WriteLine(text);
        }
    }
}

सेल के लिए बैकग्राउंड कलर सेट करने का तरीका दिखाता है।

// दस्तावेज़ वर्ग का एक ऑब्जेक्ट बनाएँ
Document doc = new Document();

// टेबलसेल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें और टेक्स्ट कंटेंट सेट करें
TableCell cell11 = new TableCell(doc);
cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
cell11.BackgroundColor = Color.Coral;

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row = new TableRow(doc);
row.AppendChildLast(cell11);

Table table = new Table(doc)
              {
                  IsBordersVisible = true,
                  Columns = { new TableColumn() { Width = 200 } }
              };
table.AppendChildLast(row);

OutlineElement oe = new OutlineElement(doc);
oe.AppendChildLast(table);

Outline o = new Outline(doc);
o.AppendChildLast(oe);

// पेज क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
Page page = new Page(doc);
page.AppendChildLast(o);

doc.AppendChildLast(page);

doc.Save(Path.Combine(RunExamples.GetDataDir_Tables(), "SettingCellBackGroundColor.pdf"));

टैग के साथ नई तालिका जोड़ने का तरीका दिखाता है।

// दस्तावेज़ निर्देशिका का पथ।
string dataDir = RunExamples.GetDataDir_Tags();

// दस्तावेज़ वर्ग का एक ऑब्जेक्ट बनाएँ
Document doc = new Document();

// पेज क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
Aspose.Note.Page page = new Aspose.Note.Page(doc);

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row = new TableRow(doc);

// टेबलसेल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableCell cell = new TableCell(doc);

// सेल सामग्री डालें
cell.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Single cell."));

// पंक्ति नोड में सेल जोड़ें
row.AppendChildLast(cell);

// टेबल नोड को इनिशियलाइज़ करें
Table table = new Table(doc)
              {
                  IsBordersVisible = true,
                  Columns = { new TableColumn { Width = 70 } }
              };

// तालिका में पंक्ति नोड डालें
table.AppendChildLast(row);

// इस टेबल नोड में टैग जोड़ें
table.Tags.Add(NoteTag.CreateQuestionMark());

Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);

// टेबल नोड जोड़ें
outlineElem.AppendChildLast(table);

// रूपरेखा तत्व जोड़ें
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
doc.AppendChildLast(page);

// OneNote दस्तावेज़ सहेजें
dataDir = dataDir + "AddTableNodeWithTag_out.one";
doc.Save(dataDir);

लॉक किए गए कॉलम के साथ टेबल बनाने का तरीका दिखाता है।

// दस्तावेज़ निर्देशिका का पथ।
string dataDir = RunExamples.GetDataDir_Tables();

// दस्तावेज़ वर्ग का एक ऑब्जेक्ट बनाएँ
Document doc = new Document();

// पेज क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
Aspose.Note.Page page = new Aspose.Note.Page(doc);

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row1 = new TableRow(doc);

// टेबलसेल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें और टेक्स्ट कंटेंट सेट करें
TableCell cell11 = new TableCell(doc);
cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
row1.AppendChildLast(cell11);

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row2 = new TableRow(doc);

// टेबलसेल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें और टेक्स्ट कंटेंट सेट करें
TableCell cell21 = new TableCell(doc);
cell21.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Long   text    with    several   words and    spaces."));
row2.AppendChildLast(cell21);

// टेबल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
Table table = new Table(doc)
              {
                  IsBordersVisible = true,
                  Columns = { new TableColumn { Width = 70, LockedWidth = true } }
              };

// पंक्तियां जोड़ें
table.AppendChildLast(row1);
table.AppendChildLast(row2);

Outline outline = new Outline(doc);
OutlineElement outlineElem = new OutlineElement(doc);

// टेबल नोड जोड़ें
outlineElem.AppendChildLast(table);

// रूपरेखा तत्व नोड जोड़ें
outline.AppendChildLast(outlineElem);

// आउटलाइन नोड जोड़ें
page.AppendChildLast(outline);

// पेज नोड जोड़ें
doc.AppendChildLast(page);
dataDir = dataDir + "CreateTableWithLockedColumns_out.one";
doc.Save(dataDir);

दिखाता है कि एक नई तालिका कैसे बनाई जाती है।

// दस्तावेज़ निर्देशिका का पथ।
string dataDir = RunExamples.GetDataDir_Tables();

// दस्तावेज़ वर्ग का एक ऑब्जेक्ट बनाएँ
Document doc = new Document();

// पेज क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
Aspose.Note.Page page = new Aspose.Note.Page(doc);

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row1 = new TableRow(doc);

// टेबलसेल क्लास ऑब्जेक्ट्स को इनिशियलाइज़ करें
TableCell cell11 = new TableCell(doc);
TableCell cell12 = new TableCell(doc);
TableCell cell13 = new TableCell(doc);

// टेबल सेल में आउटलाइन एलिमेंट्स जोड़ें
cell11.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.1"));
cell12.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.2"));
cell13.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.3"));

// तालिका कक्ष पंक्तियों के लिए
row1.AppendChildLast(cell11);
row1.AppendChildLast(cell12);
row1.AppendChildLast(cell13);

// TableRow क्लास ऑब्जेक्ट को इनिशियलाइज़ करें
TableRow row2 = new TableRow(doc);

// टेबलसेल क्लास ऑब्जेक्ट्स को इनिशियलाइज़ करें
TableCell cell21 = new TableCell(doc);
TableCell cell22 = new TableCell(doc);
TableCell cell23 = new TableCell(doc);

// टेबल सेल में आउटलाइन एलिमेंट्स जोड़ें
cell21.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.1"));
cell22.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.2"));
cell23.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.3"));

// तालिका कक्षों को पंक्तियों में जोड़ें
row2.AppendChildLast(cell21);
row2.AppendChildLast(cell22);
row2.AppendChildLast(cell23);

// टेबल क्लास ऑब्जेक्ट को इनिशियलाइज़ करें और कॉलम की चौड़ाई सेट करें
Table table = new Table(doc)
              {
                  IsBordersVisible = true,
                  Columns = { new TableColumn { Width = 200 }, new TableColumn { Width = 200 }, new TableColumn { Width = 200 } }
              };

// तालिका पंक्तियों को तालिका में जोड़ें
table.AppendChildLast(row1);
table.AppendChildLast(row2);

// आउटलाइन ऑब्जेक्ट को इनिशियलाइज़ करें
Outline outline = new Outline(doc);

// आउटलाइन एलिमेंट ऑब्जेक्ट को इनिशियलाइज़ करें
OutlineElement outlineElem = new OutlineElement(doc);

// एलिमेंट नोड को आउटलाइन करने के लिए टेबल जोड़ें
outlineElem.AppendChildLast(table);

// रूपरेखा तत्व को रूपरेखा में जोड़ें
outline.AppendChildLast(outlineElem);

// पेज नोड में रूपरेखा जोड़ें
page.AppendChildLast(outline);

// दस्तावेज़ नोड में पृष्ठ जोड़ें
doc.AppendChildLast(page);
dataDir = dataDir + "InsertTable_out.one";
doc.Save(dataDir);

यह सभी देखें