Aspose.Cells.WorkbookDesigner.SetDataSource(System.Data.DataTable)

Here are the examples of the csharp api class Aspose.Cells.WorkbookDesigner.SetDataSource(System.Data.DataTable) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

15 Examples 7

1. Example

Project: Aspose.Cells-for-.NET
Source File: AddCustomLabels.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            // Instantiate the workbook from a template file that contains Smart Markers
            Workbook workbook = new Workbook(dataDir + "Book1.xlsx");
            Workbook designer = new Workbook(dataDir + "SmartMarker_Designer.xlsx");

            // Export data from the first worksheet to fill a data table
            DataTable dt = workbook.Worksheets[0].Cells.ExportDataTable(0, 0, 11, 5, true);
            
            // Instantiate a new WorkbookDesigner
            WorkbookDesigner d = new WorkbookDesigner();

            // Specify the workbook to the designer book
            d.Workbook = workbook;

            // Set the table name
            dt.TableName = "Report";

            // Set the data source
            d.SetDataSource(dt);

            // Process the smart markers
            d.Process();

            // Save the Excel file
            workbook.Save(dataDir + "output.xlsx", SaveFormat.Xlsx);
            // ExEnd:1

        }

2. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string FilePath = @"..\..\..\Sample Files\";
 /n ..... /n //View Source file for more details /n }

3. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string MyDir = @"Files\";
            //Create/n ..... /n //View Source file for more details /n }

4. Example

Project: Aspose.Cells-for-.NET
Source File: GroupingData.cs
public static void Run()
        {
            //ExStart:GroupingData
            // The path to the/n ..... /n //View Source file for more details /n }

5. Example

Project: Aspose.Cells-for-.NET
Source File: GetSmartMarkerNotifications.cs
public static void Run()
        {
            // ExStart:1
            string dataDir = RunExamples/n ..... /n //View Source file for more details /n }

6. Example

Project: Aspose.Cells-for-.NET
Source File: GroupingData.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents/n ..... /n //View Source file for more details /n }

7. Example

Project: Aspose.Cells-for-.NET
Source File: CopyStyleWithSmartMarker.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents/n ..... /n //View Source file for more details /n }

8. Example

Project: Aspose.Cells-for-.NET
Source File: UsingCopyStyleAttribute.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents/n ..... /n //View Source file for more details /n }

9. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string FilePath = @"..\..\..\Sample Files\";
            string FileName = FilePath + "Image Markers.xlsx";
            
            //Get the image data.
            byte[] imageData = File.ReadAllBytes(FilePath + "Aspose.Cells.png");
            //Create a datatable.
            DataTable t = new DataTable("Table1");
            //Add a column to save pictures.
            DataColumn dc = t.Columns.Add("Picture");
            //Set its data type.
            dc.DataType = typeof(object);

            //Add a new new record to it.
            DataRow row = t.NewRow();
            row[0] = imageData;
            t.Rows.Add(row);

            //Add another record (having picture) to it.
            //imageData = File.ReadAllBytes(FilePath + "Desert.jpg");
            //row = t.NewRow();
            //row[0] = imageData;
            //t.Rows.Add(row);

            //Create WorkbookDesigner object.
            WorkbookDesigner designer = new WorkbookDesigner();
            //Open the temple Excel file.
            designer.Workbook = new Workbook(FileName);
            //Set the datasource.
            designer.SetDataSource(t);
            //Process the markers.
            designer.Process();
            //Save the Excel file.
            designer.Workbook.Save(FileName);
        }

10. Example

Project: Aspose.Cells-for-.NET
Source File: Program.cs
static void Main(string[] args)
        {
            string MyDir = @"Files\";
            //Get the image data.
            byte[] imageData = File.ReadAllBytes(MyDir + "Thumbnail.jpg");
            //Create a datatable.
            DataTable t = new DataTable("Table1");
            //Add a column to save pictures.
            DataColumn dc = t.Columns.Add("Picture");
            //Set its data type.
            dc.DataType = typeof(object);

            //Add a new new record to it.
            DataRow row = t.NewRow();
            row[0] = imageData;
            t.Rows.Add(row);

            //Add another record (having picture) to it.
            imageData = File.ReadAllBytes(MyDir + "Desert.jpg");
            row = t.NewRow();
            row[0] = imageData;
            t.Rows.Add(row);

            //Create WorkbookDesigner object.
            WorkbookDesigner designer = new WorkbookDesigner();
            //Open the temple Excel file.
            designer.Workbook = new Workbook(MyDir + "ImageSmartBook.xls");
            //Set the datasource.
            designer.SetDataSource(t);
            //Process the markers.
            designer.Process();
            //Save the Excel file.
            designer.Workbook.Save(MyDir + "out_ImageSmartBook.xls");
        }

11. Example

Project: Aspose.Cells-for-.NET
Source File: ImageMarkers.cs
public static void Run()
        {
            //ExStart:ImageMarkers
            // The path to the/n ..... /n //View Source file for more details /n }

12. Example

Project: Aspose.Cells-for-.NET
Source File: UsingCopyStyleAttribute.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents/n ..... /n //View Source file for more details /n }

13. Example

Project: Aspose.Cells-for-.NET
Source File: ImageMarkers.cs
public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Get the image data.
            byte[] imageData = File.ReadAllBytes(dataDir+ "aspose-logo.jpg");
            // Create a datatable.
            DataTable t = new DataTable("Table1");
            // Add a column to save pictures.
            DataColumn dc = t.Columns.Add("Picture");
            // Set its data type.
            dc.DataType = typeof(object);

            // Add a new new record to it.
            DataRow row = t.NewRow();
            row[0] = imageData;
            t.Rows.Add(row);

            // Add another record (having picture) to it.
            imageData = File.ReadAllBytes(dataDir+ "image2.jpg");
            row = t.NewRow();
            row[0] = imageData;
            t.Rows.Add(row);

            // Create WorkbookDesigner object.
            WorkbookDesigner designer = new WorkbookDesigner();
            // Open the template Excel file.
            designer.Workbook = new Workbook(dataDir+ "TestSmartMarkers.xlsx");
            // Set the datasource.
            designer.SetDataSource(t);
            // Process the markers.
            designer.Process();
            // Save the Excel file.
            designer.Workbook.Save(dataDir+ "output.xls");
            // ExEnd:1

        }

14. Example

Project: Aspose.Cells-for-.NET
Source File: UsingFormulaParameterInSmartMarkerField.cs
public static void Run()
        {
            //Source directory
            string sourceDir = Run/n ..... /n //View Source file for more details /n }

15. Example

Project: Aspose.Cells-for-.NET
Source File: GenerateChartByProcessingSmartMarkers.cs
public static void Run()
        {
            // ExStart:CreationOfDesignerSpreadsheet
            /n ..... /n //View Source file for more details /n }