Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
765963c
Add example: load-an-excel-worksheet-insert-a-timeline-for-sales-data…
agent-aspose-cells-examples May 18, 2026
9b027e9
Add example: draw-a-timeline-while-converting-the-entire-workbook-to-…
agent-aspose-cells-examples May 18, 2026
c672494
Add example: apply-a-gradient-background-to-a-timeline-adjust-label-r…
agent-aspose-cells-examples May 18, 2026
9ba0630
Add example: batch-process-multiple-worksheets-creating-individual-ti…
agent-aspose-cells-examples May 18, 2026
9702509
Add example: validate-timeline-date-ranges-against-a-predefined-calen…
agent-aspose-cells-examples May 18, 2026
5885b5f
Add example: update-an-existing-timeline-by-adding-a-new-data-series-…
agent-aspose-cells-examples May 18, 2026
f0d60c5
Add example: apply-conditional-formatting-to-timeline-bars-based-on-p…
agent-aspose-cells-examples May 18, 2026
bc6f025
Add example: embed-a-rendered-timeline-image-into-a-pdf-report-header…
agent-aspose-cells-examples May 18, 2026
a7cd4a7
Add example: create-a-timeline-using-a-custom-template-file-then-repl…
agent-aspose-cells-examples May 18, 2026
c98e533
Add example: render-a-timeline-with-shadow-effects-adjust-opacity-and…
agent-aspose-cells-examples May 18, 2026
a9045a3
Add example: combine-two-separate-timelines-into-a-single-composite-v…
agent-aspose-cells-examples May 18, 2026
2d8d944
Add example: apply-a-dark-theme-to-a-timeline-change-axis-colors-and-…
agent-aspose-cells-examples May 18, 2026
0c96fbd
Add example: load-a-csv-file-containing-event-dates-convert-it-to-an-…
agent-aspose-cells-examples May 18, 2026
85c030f
Add example: create-a-timeline-with-custom-date-format-ddmmmyyyy-and-…
agent-aspose-cells-examples May 18, 2026
7b33cd3
Add example: render-a-timeline-with-data-labels-showing-percentages-a…
agent-aspose-cells-examples May 18, 2026
ba4b256
Add example: batch-convert-excel-files-add-a-timeline-to-each-and-sav…
agent-aspose-cells-examples May 18, 2026
9c3118a
Add example: apply-a-watermark-text-over-a-rendered-timeline-image-an…
agent-aspose-cells-examples May 18, 2026
090d0ee
Add example: create-a-timeline-with-a-logarithmic-scale-for-dates-cus…
agent-aspose-cells-examples May 18, 2026
c8c29f4
Add example: export-a-timeline-directly-to-a-memory-stream-in-pdf-for…
agent-aspose-cells-examples May 18, 2026
b3b0509
Add example: add-interactive-hyperlinks-to-timeline-markers-that-open…
agent-aspose-cells-examples May 18, 2026
982baa8
Add example: render-a-timeline-with-a-3d-perspective-effect-adjust-de…
agent-aspose-cells-examples May 18, 2026
05e7855
Update agents.md
agent-aspose-cells-examples May 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,111 @@
"language": "csharp",
"framework": ".NET",
"examples": [
{
"category": "timeline",
"file": "add-interactive-hyperlinks-to-timeline-markers-that-open-related-worksheets-when-the-pdf-is-viewed.cs",
"title": "Add interactive hyperlinks to timeline markers that open related worksheets when the PDF is viewed."
},
{
"category": "timeline",
"file": "apply-a-dark-theme-to-a-timeline-change-axis-colors-and-render-the-result-to-a-pdf.cs",
"title": "Apply a dark theme to a timeline, change axis colors, and render the result to a PDF."
},
{
"category": "timeline",
"file": "apply-a-gradient-background-to-a-timeline-adjust-label-rotation-and-render-it-to-a-bmp-image.cs",
"title": "Apply a gradient background to a timeline, adjust label rotation, and render it to a BMP image."
},
{
"category": "timeline",
"file": "apply-a-watermark-text-over-a-rendered-timeline-image-and-export-the-final-picture-as-a-pdf.cs",
"title": "Apply a watermark text over a rendered timeline image and export the final picture as a PDF."
},
{
"category": "timeline",
"file": "apply-conditional-formatting-to-timeline-bars-based-on-performance-thresholds-and-export-the-result-as-a-pdf.cs",
"title": "Apply conditional formatting to timeline bars based on performance thresholds and export the result as a PDF."
},
{
"category": "timeline",
"file": "batch-convert-excel-files-add-a-timeline-to-each-and-save-pdfs-to-an-output-directory.cs",
"title": "Batch convert Excel files, add a timeline to each, and save PDFs to an output directory."
},
{
"category": "timeline",
"file": "batch-process-multiple-worksheets-creating-individual-timelines-for-each-and-saving-them-as-separate-png-files.cs",
"title": "Batch process multiple worksheets, creating individual timelines for each and saving them as separate PNG files."
},
{
"category": "timeline",
"file": "combine-two-separate-timelines-into-a-single-composite-view-and-save-the-merged-chart-as-an-svg-file.cs",
"title": "Combine two separate timelines into a single composite view and save the merged chart as an SVG file."
},
{
"category": "timeline",
"file": "create-a-timeline-using-a-custom-template-file-then-replace-placeholder-text-with-dynamic-project-names.cs",
"title": "Create a timeline using a custom template file, then replace placeholder text with dynamic project names."
},
{
"category": "timeline",
"file": "create-a-timeline-with-a-logarithmic-scale-for-dates-customize-tick-intervals-and-render-to-png.cs",
"title": "Create a timeline with a logarithmic scale for dates, customize tick intervals, and render to PNG."
},
{
"category": "timeline",
"file": "create-a-timeline-with-custom-date-format-ddmmmyyyy-and-export-the-chart-to-a-pdf-document.cs",
"title": "Create a timeline with custom date format (dd\u2011MMM\u2011yyyy) and export the chart to a PDF document."
},
{
"category": "timeline",
"file": "draw-a-timeline-while-converting-the-entire-workbook-to-pdf-ensuring-the-timeline-appears-on-each-page.cs",
"title": "Draw a timeline while converting the entire workbook to PDF, ensuring the timeline appears on each page."
},
{
"category": "timeline",
"file": "embed-a-rendered-timeline-image-into-a-pdf-report-header-aligning-it-with-the-document-title.cs",
"title": "Embed a rendered timeline image into a PDF report header, aligning it with the document title."
},
{
"category": "timeline",
"file": "export-a-timeline-directly-to-a-memory-stream-in-pdf-format-for-further-processing-without-disk-io.cs",
"title": "Export a timeline directly to a memory stream in PDF format for further processing without disk I/O."
},
{
"category": "timeline",
"file": "load-a-csv-file-containing-event-dates-convert-it-to-an-excel-worksheet-and-draw-a-timeline.cs",
"title": "Load a CSV file containing event dates, convert it to an Excel worksheet, and draw a timeline."
},
{
"category": "timeline",
"file": "load-an-excel-worksheet-insert-a-timeline-for-sales-data-and-export-the-sheet-to-pdf.cs",
"title": "Load an Excel worksheet, insert a timeline for sales data, and export the sheet to PDF."
},
{
"category": "timeline",
"file": "render-a-timeline-with-a-3d-perspective-effect-adjust-depth-and-output-as-a-png-image.cs",
"title": "Render a timeline with a 3\u2011D perspective effect, adjust depth, and output as a PNG image."
},
{
"category": "timeline",
"file": "render-a-timeline-with-data-labels-showing-percentages-adjust-label-font-size-and-save-as-png.cs",
"title": "Render a timeline with data labels showing percentages, adjust label font size, and save as PNG."
},
{
"category": "timeline",
"file": "render-a-timeline-with-shadow-effects-adjust-opacity-and-output-the-image-as-a-png-with-transparency.cs",
"title": "Render a timeline with shadow effects, adjust opacity, and output the image as a PNG with transparency."
},
{
"category": "timeline",
"file": "update-an-existing-timeline-by-adding-a-new-data-series-and-rerender-it-to-a-pdf-with-annotations.cs",
"title": "Update an existing timeline by adding a new data series and re\u2011render it to a PDF with annotations."
},
{
"category": "timeline",
"file": "validate-timeline-date-ranges-against-a-predefined-calendar-and-log-any-inconsistencies-to-a-text-file.cs",
"title": "Validate timeline date ranges against a predefined calendar and log any inconsistencies to a text file."
},
{
"category": "workbook-merger",
"file": "add-a-timestamp-worksheet-indicating-the-exact-date-and-time-of-the-merge-operation.cs",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using Aspose.Cells;
using Aspose.Cells.Pivot;
using Aspose.Cells.Timelines;
using Aspose.Cells.Rendering;

namespace AsposeCellsTimelineHyperlinkDemo
{
class Program
{
static void Main()
{
try
{
// Create a new workbook and get the first worksheet
Workbook workbook = new Workbook();
Worksheet sheet1 = workbook.Worksheets[0];
sheet1.Name = "Data";

// Populate sample data for a pivot table
sheet1.Cells["A1"].Value = "Date";
sheet1.Cells["B1"].Value = "Category";
sheet1.Cells["C1"].Value = "Sales";

sheet1.Cells["A2"].Value = new DateTime(2023, 1, 1);
sheet1.Cells["B2"].Value = "A";
sheet1.Cells["C2"].Value = 100;

sheet1.Cells["A3"].Value = new DateTime(2023, 2, 1);
sheet1.Cells["B3"].Value = "B";
sheet1.Cells["C3"].Value = 150;

sheet1.Cells["A4"].Value = new DateTime(2023, 3, 1);
sheet1.Cells["B4"].Value = "A";
sheet1.Cells["C4"].Value = 200;

// Create a pivot table based on the data
int pivotIdx = sheet1.PivotTables.Add("A1:C4", "E1", "SalesPivot");
PivotTable pivot = sheet1.PivotTables[pivotIdx];

// Add the Date field to the Page (filter) area – required for a timeline
pivot.AddFieldToArea(PivotFieldType.Page, "Date");
pivot.AddFieldToArea(PivotFieldType.Row, "Category");
pivot.AddFieldToArea(PivotFieldType.Data, "Sales");

// Refresh and calculate the pivot table
pivot.RefreshData();
pivot.CalculateData();

// Add a timeline control linked to the Date field of the pivot table
int timelineIdx = sheet1.Timelines.Add(pivot, "A10", "Date");
Timeline timeline = sheet1.Timelines[timelineIdx];

// Add a second worksheet that will be the hyperlink target
Worksheet sheet2 = workbook.Worksheets.Add("Details");
sheet2.Cells["A1"].Value = "Details for selected period";

// Set a hyperlink on the timeline shape to open the target worksheet cell when PDF is viewed
timeline.Shape.Hyperlink.Address = "Details!A1";
timeline.Shape.Hyperlink.TextToDisplay = "Go to Details";

// Save the workbook as PDF with the hyperlink active
PdfSaveOptions pdfOptions = new PdfSaveOptions();
workbook.Save("TimelineWithHyperlink.pdf", pdfOptions);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
112 changes: 112 additions & 0 deletions timeline/agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
category: timeline
framework: .NET
parent: ../agents.md
version: v2
---

# Persona

You are a C# developer specializing in timeline features using Aspose.Cells for .NET.

Generate simple, correct, production-quality examples that demonstrate ONE timeline scenario at a time.

---

# Scope

- Standalone .cs examples
- One operation per example
- Fully runnable with dotnet run
- No external dependencies

---

# Required Namespaces

using System;
using Aspose.Cells;
using Aspose.Cells.Pivot;

---

# Key APIs

- Timeline
- TimelineCollection
- PivotTable
- Worksheet.Timelines

---

# Common Pattern

1. Create workbook
2. Create sample date-based data
3. Create PivotTable
4. Create Timeline
5. Save workbook
6. Print success message

---

# Timeline Rules

- Timelines require a PivotTable data source
- Include valid date fields
- Use realistic sample data
- One example = one timeline operation

---

# Input Strategy

- Do NOT rely on external XLSX files
- Create all data programmatically
- Keep examples self-contained

---

# Output Rules

- Always generate output.xlsx
- Ensure workbook is saved successfully
- Output files are written to the working directory

---

# Common Tasks

- Create timeline
- Access timelines
- Modify timeline properties
- Connect timeline to PivotTable

---

# Common Mistakes

❌ var workbook = new Workbook();
✅ Workbook workbook = new Workbook();

❌ Use timeline without date fields
✅ Create valid date-based source data

❌ Workbook workbook = new Workbook("input.xlsx");
✅ Workbook workbook = new Workbook();

---

# Code Simplicity

- Keep examples concise
- Avoid unnecessary abstractions

---

# General Rules

Refer to the root agents.md for:
- Boundaries
- Testing requirements
- Build and run instructions
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.Drawing;
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Charts;
using Aspose.Cells.Pivot;
using Aspose.Cells.Timelines;
using Aspose.Cells.Rendering;

namespace AsposeCellsTimelineDarkThemePdf
{
public class Program
{
public static void Main()
{
try
{
// Create a new workbook and get the first worksheet
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
Cells cells = sheet.Cells;

// -------------------------------------------------
// Populate sample data (Date, Category, Value)
// -------------------------------------------------
cells["A1"].PutValue("Date");
cells["B1"].PutValue("Category");
cells["C1"].PutValue("Value");

DateTime start = new DateTime(2023, 1, 1);
for (int i = 0; i < 6; i++)
{
cells[$"A{2 + i}"].PutValue(start.AddDays(i * 7));
cells[$"B{2 + i}"].PutValue(i % 2 == 0 ? "Alpha" : "Beta");
cells[$"C{2 + i}"].PutValue(10 + i * 5);
}

// -------------------------------------------------
// Create a PivotTable based on the data
// -------------------------------------------------
PivotTableCollection pivots = sheet.PivotTables;
int pivotIdx = pivots.Add("A1:C7", "E1", "PivotTable1");
PivotTable pivot = pivots[pivotIdx];
pivot.AddFieldToArea(PivotFieldType.Row, "Date");
pivot.AddFieldToArea(PivotFieldType.Column, "Category");
pivot.AddFieldToArea(PivotFieldType.Data, "Value");
pivot.PivotTableStyleType = PivotTableStyleType.PivotTableStyleMedium9;
pivot.RefreshData();
pivot.CalculateData();

// -------------------------------------------------
// Add a Timeline linked to the PivotTable (base field: Date)
// -------------------------------------------------
int timelineIdx = sheet.Timelines.Add(pivot, 12, 0, "Date");
Timeline timeline = sheet.Timelines[timelineIdx];
timeline.Caption = "Sales Timeline";
timeline.ShowHeader = true;
timeline.ShowHorizontalScrollbar = true;
timeline.ShowSelectionLabel = true;
timeline.ShowTimeLevel = true;

// -------------------------------------------------
// Apply a dark custom theme (background dark, text light)
// -------------------------------------------------
Color[] darkTheme = new Color[]
{
Color.FromArgb(30, 30, 30), // Background1 (dark gray)
Color.White, // Text1 (white)
Color.FromArgb(45, 45, 45), // Background2 (slightly lighter gray)
Color.White, // Text2 (white)
Color.FromArgb(0, 120, 215), // Accent1 (blue)
Color.FromArgb(0, 153, 0), // Accent2 (green)
Color.FromArgb(255, 140, 0), // Accent3 (orange)
Color.FromArgb(191, 0, 0), // Accent4 (red)
Color.FromArgb(102, 102, 102) // Accent5 (medium gray)
};
// Note: Aspose.Cells does not provide a direct API to replace the built‑in theme,
// but you can apply the colors to styles as needed. For this sample we keep it simple.

// -------------------------------------------------
// Save the workbook as PDF
// -------------------------------------------------
string outputPath = "TimelineDarkTheme.pdf";
workbook.Save(outputPath, SaveFormat.Pdf);
Console.WriteLine($"Workbook saved to {Path.GetFullPath(outputPath)}");
}
catch (Exception ex)
{
// Runtime safety: log any unexpected errors
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
Loading