Filling the table single column at a time

Hi, I am trying to add some data to a table in slide, issue is the data is dynamic so are the number of rows and columns, I want to add it 10 rows max in one column, and want to fill one column than add another and likewise.

Is there any way we can do it?

Also is there any way to dynamically control the position of the table in the slide?

Try something like this:

var presentation = new PresentationDocument();
var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);
var table = slide.Content.AddTable(0.5, 0.5, 0, 0, LengthUnit.Centimeter);
int maxCellsPerColumn = 10;

var random = new Random();
var randomData = Enumerable.Range(1, random.Next(2, 10))
    .SelectMany(i => Enumerable.Repeat("COL_" + i, maxCellsPerColumn));

int r = 0, columnCount = 0;
foreach (string item in randomData)
    if (r % maxCellsPerColumn == 0)
        r = 0;

    var row = r < table.Rows.Count ?
        table.Rows[r] :
        table.Rows.AddNew(Length.From(1, LengthUnit.Centimeter));

    var cell = row.Cells.AddNew();


for (int i = 0; i < columnCount; i++)
    table.Columns.AddNew(Length.From(2.5, LengthUnit.Centimeter));
table.Frame.Layout.Width = Length.From(2.5 + columnCount, LengthUnit.Centimeter);


Does this solve your issue?

Hi mario, i took another path for this fix but still thanks alot for the soultion, there is one more thing i had, in chart how to add curreny format for 100K like numbers and 1M like numbers because , I am not getting this any solution for that.

Your forum post here talks about tables, not charts.
Nevertheless, I don’t think there is any number format that you could use to get 100K, 1M, etc. values.
So, you’ll need to have those labels written in a column and use them as a value axis.