public static void Run()
        {
            // ExStart:CreateTableWithLockedColumns
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Tables();

            // Create an object of the Document class
            Document doc = new Document();

            // Initialize Page class object
            Aspose.Note.Page page = new Aspose.Note.Page(doc);

            // Initialize TableRow class object
            TableRow row1 = new TableRow(doc);
            // Initialize TableCell class object and set text content
            TableCell cell11 = new TableCell(doc);

            cell11.AppendChild(InsertTable.GetOutlineElementWithText(doc, "Small text"));
            row1.AppendChild(cell11);

            // Initialize TableRow class object
            TableRow row2 = new TableRow(doc);
            // Initialize TableCell class object and set text content
            TableCell cell21 = new TableCell(doc);

            cell21.AppendChild(InsertTable.GetOutlineElementWithText(doc, "Long   text    with    several   words and    spaces."));
            row2.AppendChild(cell21);

            // Initialize Table class object
            Table table = new Table(doc)
            {
                IsBordersVisible = true,
                Columns          = { new TableColumn {
                                         Width = 70, LockedWidth = true
                                     } }
            };

            // Add rows
            table.AppendChild(row1);
            table.AppendChild(row2);

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

            // Add table node
            outlineElem.AppendChild(table);
            // Add outline element node
            outline.AppendChild(outlineElem);
            // Add outline node
            page.AppendChild(outline);
            // Add page node
            doc.AppendChild(page);
            dataDir = dataDir + "CreateTableWithLockedColumns_out_.one";
            doc.Save(dataDir);
            // ExEnd:CreateTableWithLockedColumns

            Console.WriteLine("\nTable with locked columns created successfully.\nFile saved at " + dataDir);
        }
示例#2
0
        public static void Run()
        {
            // ExStart:SettingCellBackGroundColor
            // ExFor:Table
            // ExFor:Table.Columns
            // ExFor:Table.IsBordersVisible
            // ExFor:TableColumn
            // ExFor:TableColumn.Width
            // ExFor:TableRow
            // ExFor:TableCell
            // ExFor:TableCell.BackgroundColor
            // ExSummary:Shows how to set a background color for a cell.

            // Create an object of the Document class
            Document doc = new Document();

            // Initialize TableCell class object and set text content
            TableCell cell11 = new TableCell(doc);

            cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
            cell11.BackgroundColor = Color.Coral;

            // Initialize TableRow class object
            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);

            // Initialize Page class object
            Page page = new Page(doc);

            page.AppendChildLast(o);

            doc.AppendChildLast(page);

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

            // ExEnd:SettingCellBackGroundColor
        }
示例#3
0
        public static void Run()
        {
            // ExStart:SettingCellBackGroundColor
            // Create an object of the Document class
            Document doc = new Document();

            // Initialize Page class object
            Aspose.Note.Page page = new Aspose.Note.Page(doc);

            // Initialize TableRow class object
            TableRow row1 = new TableRow(doc);
            // Initialize TableCell class object and set text content
            TableCell cell11 = new TableCell(doc);

            cell11.AppendChild(InsertTable.GetOutlineElementWithText(doc, "Small text"));
            cell11.BackgroundColor = Color.Coral;
            row1.AppendChild(cell11);
            // ExEnd:SettingCellBackGroundColor
        }