### CLI Usage for GAEB File Conversion
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Command-line examples for converting GAEB files between various formats (GAEB 90, GAEB 2000, GAEB XML, Excel) and applying options like stripping prices or printing positions. The CLI tool supports input from GAEB or Excel and outputs to specified formats.
```bash
# Convert GAEB XML to Excel
Dangl.AVA.Examples.exe -i input.x83 -o output -t Excel
# Convert GAEB 90 to GAEB 2000
Dangl.AVA.Examples.exe -i input.d83 -o output -t Gaeb2000
# Convert to GAEB XML with prices stripped
Dangl.AVA.Examples.exe -i input.p83 -o output -t GaebXml -s
# Convert and print all positions to console
Dangl.AVA.Examples.exe -i input.x83 -o output -t Excel -p
# Convert without branding comment
Dangl.AVA.Examples.exe -i input.d83 -o output -t GaebXml -e
# CLI Parameters:
# -i, --input Required. Path to input GAEB or Excel file
# -o, --output Required. Path to output file (without extension)
# -t, --target Required. Target format: Gaeb90, Gaeb2000, GaebXml, or Excel
# -s, --stripPrices Optional. Remove all prices from output
# -p, --printPositions Optional. Print positions to console
# -e, --excludeBranding Optional. Exclude library branding comment
```
--------------------------------
### Roundtrip Conversion Between GAEB Formats
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Demonstrates a complete roundtrip conversion process: GAEB 90 to Project model, then to GAEB 2000, back to Project model, and finally to GAEB XML. This showcases the library's ability to preserve data across different GAEB versions.
```csharp
using System.IO;
using Dangl.AVA.Converter;
using Dangl.GAEB.Reader;
using Dangl.GAEB.Writer;
// Complete roundtrip: GAEB 90 -> Project -> GAEB 2000 -> Project -> GAEB XML
using (var inputStream = File.OpenRead("original.d83"))
{
// Read GAEB 90
var gaeb90 = GAEBReader.ReadGaeb(inputStream);
// Convert to unified model
var project = Converter.ConvertFromGaeb(gaeb90);
// Export to GAEB 2000
var gaeb2000 = Converter.ConvertToGaeb(project, destinationType: DestinationGAEBType.GAEB2000);
// Convert back to project
var projectFromGaeb2000 = Converter.ConvertFromGaeb(gaeb2000);
// Export to GAEB XML
var gaebXml = Converter.ConvertToGaeb(projectFromGaeb2000, destinationType: DestinationGAEBType.GAEBXML_V3_2);
// Write final output
using (var outputStream = GAEBWriter.GetStream(gaebXml, includeBrandingComment: true))
using (var fileStream = File.Create("converted.x83"))
{
outputStream.CopyTo(fileStream);
}
}
```
--------------------------------
### Convert GAEB to Unified AVA Project Model
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Transform a GAEB file into the universal AVA Project model using Converter.ConvertFromGaeb(). This model provides a consistent interface for accessing data and supports UI binding.
```csharp
using System.IO;
using System.Linq;
using Dangl.GAEB.Reader;
using Dangl.AVA.Converter;
// Read GAEB file and convert to unified Project model
using (var fileStream = File.OpenRead("construction-bid.x83"))
{
var gaebFile = GAEBReader.ReadGaeb(fileStream);
var project = Converter.ConvertFromGaeb(gaebFile);
// Access project data through unified model
var serviceSpec = project.ServiceSpecifications.First();
Console.WriteLine($"Origin: {serviceSpec.Origin}"); // e.g., Origin.GaebXml
Console.WriteLine($"Currency: {serviceSpec.PriceInformation.Currency}");
Console.WriteLine($"Tax Rate: {serviceSpec.PriceInformation.TaxRate}%");
}
```
--------------------------------
### Configure .NET Target Framework
Source: https://github.com/georgdangl/dangl.ava.examples/blob/master/README.md
Modify the TargetFramework property in the .csproj file to switch between .NET Framework and modern .NET versions.
```xml
Exe
net461
net8.0
```
--------------------------------
### Write AVA Project to Excel Format
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Export an AVA Project to a structured Excel spreadsheet using Converter.Excel.Writer.GetStream(). This creates a file that can be read back by the library.
```csharp
using System.IO;
using Dangl.AVA.Converter.Excel;
// Export project to Excel
using (var excelStream = Writer.GetStream(project))
using (var fileStream = File.Create("output.xlsx"))
{
excelStream.CopyTo(fileStream);
}
```
--------------------------------
### Convert AVA Project to GAEB Format
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Use Converter.ConvertToGaeb() to convert an AVA Project back to GAEB 90, GAEB 2000, or GAEB XML. You can specify the destination type and exchange phase.
```csharp
using Dangl.AVA.Converter;
using Dangl.GAEB.Writer;
// Convert project to GAEB 2000 format
var gaeb2000File = Converter.ConvertToGaeb(
project,
destinationType: DestinationGAEBType.GAEB2000
);
// Convert with specific exchange phase (e.g., Offer phase)
var gaebWithPhase = Converter.ConvertToGaeb(
project,
GAEBTargetExchangePhase.Offer,
destinationType: DestinationGAEBType.GAEB2000
);
// Write to file stream
using (var outputStream = GAEBWriter.GetStream(gaeb2000File, includeBrandingComment: false))
using (var fileStream = File.Create("output.p83"))
{
outputStream.CopyTo(fileStream);
}
```
--------------------------------
### Strip Prices and Deductions from Project Data
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Iterate through service specifications and recursively remove price information (global, group, and position levels) by setting relevant properties to zero or clearing collections. This is useful for creating tender documents from priced bills of quantities.
```csharp
using System.Linq;
using Dangl.AVA;
using Dangl.AVA.Contents;
using Dangl.AVA.Contents.ServiceSpecificationContents;
public void StripAllPrices(Project project)
{
foreach (var servSpec in project.ServiceSpecifications)
{
// Remove global price data
servSpec.PriceInformation.DeductionFactor = 0m;
servSpec.PriceInformation.FlatSum = 0m;
servSpec.PriceInformation.HourlyWage = 0m;
servSpec.PriceInformation.TaxRate = 0m;
servSpec.DeductionFactor = 0m;
// Remove group-level deductions
var groups = servSpec.RecursiveElements().OfType();
foreach (var group in groups)
{
group.DeductionFactor = 0m;
}
// Remove position-level prices
var positions = servSpec.RecursiveElements().OfType();
foreach (var position in positions)
{
position.DeductionFactor = 0m;
position.TaxRate = 0m;
position.UseDifferentTaxRate = false;
position.LabourComponents.HourlyWage = 0m;
position.LabourComponents.UseOwnHourlyWage = false;
position.LabourComponents.Values.Clear();
foreach (var priceComponent in position.PriceComponents)
{
priceComponent.Values.Clear();
}
}
}
}
```
--------------------------------
### Read Excel Files into AVA Project Model
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Use Converter.Excel.Reader.ReadStream() to load Excel files previously generated by the library back into the AVA Project model for further processing.
```csharp
using System.IO;
using Dangl.AVA.Converter.Excel;
// Read Excel file created by this library
using (var excelStream = File.OpenRead("bill-of-quantities.xlsx"))
{
var project = Reader.ReadStream(excelStream);
// Now convert to any GAEB format
var gaebXml = Dangl.AVA.Converter.Converter.ConvertToGaeb(
project,
destinationType: Dangl.AVA.Converter.DestinationGAEBType.GAEBXML_V3_2
);
}
```
--------------------------------
### Read GAEB Files with Auto-Format Detection
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Use GAEBReader.ReadGaeb() to parse GAEB 90, GAEB 2000, or GAEB XML files. The method automatically detects the file format and handles common errors.
```csharp
using System.IO;
using Dangl.GAEB.Reader;
// Read any GAEB file - format is auto-detected
using (var fileStream = File.OpenRead("path/to/gaeb-file.x83"))
{
// Returns the appropriate type: GAEB_File_90, GAEB_File_2000, or tgGAEB
var gaebFile = GAEBReader.ReadGaeb(fileStream);
// Check the actual type if needed
if (gaebFile is Dangl.GAEB.GAEB90.GAEB_File_90 gaeb90)
{
Console.WriteLine("Read GAEB 90 file");
}
else if (gaebFile is Dangl.GAEB.GAEB2000.GAEB_File_2000 gaeb2000)
{
Console.WriteLine("Read GAEB 2000 file");
}
else if (gaebFile is Dangl.GAEB.GAEBXML.Schemas.V3_2.Y2013.tgGAEB gaebXml)
{
Console.WriteLine("Read GAEB XML file");
}
}
```
--------------------------------
### Extract Positions from Service Specifications
Source: https://context7.com/georgdangl/dangl.ava.examples/llms.txt
Use RecursiveElements() to traverse the service specification hierarchy and extract all Position elements. This is useful for iterating through individual line items in a bill of quantities.
```csharp
using System.Linq;
using Dangl.AVA;
using Dangl.AVA.Contents.ServiceSpecificationContents;
public void PrintAllPositions(Project project)
{
var positions = project.ServiceSpecifications
.First()
.RecursiveElements()
.OfType()
.ToList();
foreach (var position in positions)
{
var itemNumber = position.ItemNumber.StringRepresentation;
var shortText = position.ShortText ?? "Unnamed Position";
var quantity = position.Quantity;
var unit = position.UnitTag;
Console.WriteLine($"{itemNumber}: {shortText} ({quantity} {unit})");
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.