Compare commits
5 Commits
98b5198f6f
..
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 9becedbd97 | |||
| 16982c3d95 | |||
| 93771dd110 | |||
| 3e14731429 | |||
| df6c187a00 |
@@ -10,6 +10,7 @@ public class Settings
|
||||
public static Settings _instance = new();
|
||||
public AddressSets addressSets = new();
|
||||
public Customers customers = new();
|
||||
public PdfExportSettings pdfExport { get; set; } = new();
|
||||
|
||||
public string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"logofclient", "config.json");
|
||||
@@ -52,6 +53,25 @@ public class Settings
|
||||
}
|
||||
}
|
||||
|
||||
public class PdfExportSettings
|
||||
{
|
||||
public double cellPaddingTopMm { get; set; } = 5;
|
||||
public double cellPaddingBottomMm { get; set; } = 5;
|
||||
public double cellPaddingLeftMm { get; set; } = 5;
|
||||
public double cellPaddingRightMm { get; set; } = 5;
|
||||
|
||||
public double pageMarginTopMm { get; set; } = 0;
|
||||
public double pageMarginBottomMm { get; set; } = 0;
|
||||
public double pageMarginLeftMm { get; set; } = 0;
|
||||
public double pageMarginRightMm { get; set; } = 0;
|
||||
|
||||
public int rowsPerPage { get; set; } = 7;
|
||||
public int columnsPerPage { get; set; } = 3;
|
||||
|
||||
public double fontSize { get; set; } = 9;
|
||||
public double smallFontSize { get; set; } = 6;
|
||||
}
|
||||
|
||||
public class Global
|
||||
{
|
||||
public static Global _instance;
|
||||
|
||||
+8
-4
@@ -270,11 +270,11 @@
|
||||
<StackPanel Grid.Column="2" Orientation="Vertical" Spacing="10">
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<Label Content="Zeilen pro Seite"></Label>
|
||||
<NumericUpDown Grid.Column="1" x:Name="TbExpMargRowsPerPage" Minimum="1" Maximum="10" Value="3"></NumericUpDown>
|
||||
<NumericUpDown Grid.Column="1" x:Name="TbExpMargRowsPerPage" Minimum="1" Maximum="10" Value="7"></NumericUpDown>
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<Label Grid.Column="0" Content="Spalten pro Seite"></Label>
|
||||
<NumericUpDown Grid.Column="1" x:Name="NudExpMargColumnsPerPage" Minimum="1" Maximum="8" Value="7"></NumericUpDown>
|
||||
<NumericUpDown Grid.Column="1" x:Name="NudExpMargColumnsPerPage" Minimum="1" Maximum="8" Value="3"></NumericUpDown>
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<Label Grid.Column="0" Content="Schriftgröße (groß)"></Label>
|
||||
@@ -287,7 +287,7 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="Start" IsEnabled="False"></Button>
|
||||
<Button Content="Start" Click="BtnStartGenerateLabels_OnClick"></Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -327,8 +327,12 @@
|
||||
<Grid ColumnDefinitions="300,*">
|
||||
<Border Grid.Column="0" Background="#FFF" BorderBrush="#DDD" BorderThickness="0,0,1,0">
|
||||
<StackPanel>
|
||||
<Button Content="+ Hinzufügen" Margin="10" x:Name="BtnWikiAddFile"
|
||||
<StackPanel Spacing="10" Orientation="Horizontal" Margin="10">
|
||||
<Button Content="+ Datei" x:Name="BtnWikiAddFile"
|
||||
Click="BtnWikiAddFile_OnClick" />
|
||||
<Button Content="+ Ordner" x:Name="BtnWikiAddFolder"
|
||||
Click="BtnWikiAddFolder_OnClick" />
|
||||
</StackPanel>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<TreeView Name="NavTree" Margin="10" />
|
||||
</ScrollViewer>
|
||||
|
||||
+191
-6
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Logof_Client.Wiki;
|
||||
|
||||
@@ -33,6 +34,8 @@ public partial class MainWindow : Window
|
||||
WindowState = WindowState.Maximized;
|
||||
Global.Load();
|
||||
Settings.Load();
|
||||
LoadPdfExportOptions();
|
||||
HookPdfExportOptionEvents();
|
||||
|
||||
RefreshCountryView();
|
||||
|
||||
@@ -257,12 +260,20 @@ public partial class MainWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
public void PopulateNavTree()
|
||||
public void PopulateNavTree(string? expandToPath = null, string? selectPath = null)
|
||||
{
|
||||
var roots = _wikiService.GetRootItems();
|
||||
var nodes = new List<TreeViewItem>();
|
||||
foreach (var r in roots) nodes.Add(BuildNode(r));
|
||||
NavTree.ItemsSource = nodes;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(expandToPath))
|
||||
ExpandAndFindNode(nodes, expandToPath, out _);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selectPath) &&
|
||||
ExpandAndFindNode(nodes, selectPath, out var selectedNode) &&
|
||||
selectedNode != null)
|
||||
NavTree.SelectedItem = selectedNode;
|
||||
}
|
||||
|
||||
private TreeViewItem BuildNode(WikiItem item)
|
||||
@@ -275,6 +286,63 @@ public partial class MainWindow : Window
|
||||
return node;
|
||||
}
|
||||
|
||||
private string GetSelectedWikiTargetDirectory()
|
||||
{
|
||||
var wikiRoot = Global._instance.wiki_storage_path;
|
||||
if (NavTree.SelectedItem is TreeViewItem treeItem && treeItem.Tag is WikiItem selectedItem)
|
||||
{
|
||||
if (selectedItem.IsFolder) return selectedItem.Path;
|
||||
|
||||
var parentDir = Path.GetDirectoryName(selectedItem.Path);
|
||||
if (!string.IsNullOrWhiteSpace(parentDir)) return parentDir;
|
||||
}
|
||||
|
||||
return wikiRoot;
|
||||
}
|
||||
|
||||
private static bool PathsEqual(string left, string right)
|
||||
{
|
||||
var normalizedLeft = Path.GetFullPath(left)
|
||||
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
var normalizedRight = Path.GetFullPath(right)
|
||||
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
|
||||
var comparison = OperatingSystem.IsWindows()
|
||||
? StringComparison.OrdinalIgnoreCase
|
||||
: StringComparison.Ordinal;
|
||||
return string.Equals(normalizedLeft, normalizedRight, comparison);
|
||||
}
|
||||
|
||||
private bool ExpandAndFindNode(IEnumerable<TreeViewItem> nodes, string targetPath, out TreeViewItem? foundNode)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
if (TryExpandToPath(node, targetPath, out foundNode))
|
||||
return true;
|
||||
|
||||
foundNode = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryExpandToPath(TreeViewItem node, string targetPath, out TreeViewItem? foundNode)
|
||||
{
|
||||
if (node.Tag is WikiItem item && PathsEqual(item.Path, targetPath))
|
||||
{
|
||||
foundNode = node;
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var childRaw in node.Items)
|
||||
if (childRaw is TreeViewItem childNode &&
|
||||
TryExpandToPath(childNode, targetPath, out foundNode))
|
||||
{
|
||||
node.IsExpanded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
foundNode = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OpenFolderButton_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var path = Global._instance.wiki_storage_path;
|
||||
@@ -735,11 +803,13 @@ public partial class MainWindow : Window
|
||||
GrdCalcMan.IsVisible = false;
|
||||
GrdCombineTypes.IsVisible = false;
|
||||
GrdExportMarginOptions.IsVisible = true;
|
||||
|
||||
LoadPdfExportOptions();
|
||||
}
|
||||
|
||||
private async void BtnStartGenerateLabels_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
SavePdfExportOptions();
|
||||
|
||||
var saveDialog = new SaveFileDialog
|
||||
{
|
||||
DefaultExtension = "pdf",
|
||||
@@ -749,7 +819,7 @@ public partial class MainWindow : Window
|
||||
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
var builder = new PdfBuilder();
|
||||
var builder = new PdfBuilder(Settings._instance.pdfExport);
|
||||
|
||||
builder.CreateAddressLabelPdfFromAddressSetWithPlaceholder(
|
||||
Convert.ToInt32(LstCustomerAdressSets.SelectedItems[0].ToString().Split(" - ")[0]),
|
||||
@@ -760,6 +830,87 @@ public partial class MainWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void HookPdfExportOptionEvents()
|
||||
{
|
||||
var controls = GetPdfExportControls();
|
||||
foreach (var control in controls) control.ValueChanged += PdfExportOption_OnValueChanged;
|
||||
}
|
||||
|
||||
private void LoadPdfExportOptions()
|
||||
{
|
||||
var options = Settings._instance.pdfExport ?? new PdfExportSettings();
|
||||
|
||||
NudExpMargCellPaddingTop.Value = (decimal)options.cellPaddingTopMm;
|
||||
NudExpMargCellPaddingBot.Value = (decimal)options.cellPaddingBottomMm;
|
||||
NudExpMargCellPaddingLeft.Value = (decimal)options.cellPaddingLeftMm;
|
||||
NudExpMargCellPaddingRight.Value = (decimal)options.cellPaddingRightMm;
|
||||
|
||||
TbExpMargMarginTop.Value = (decimal)options.pageMarginTopMm;
|
||||
TbExpMargMarginBottom.Value = (decimal)options.pageMarginBottomMm;
|
||||
TbExpMargMarginLeft.Value = (decimal)options.pageMarginLeftMm;
|
||||
TbExpMargMarginRight.Value = (decimal)options.pageMarginRightMm;
|
||||
|
||||
TbExpMargRowsPerPage.Value = options.rowsPerPage;
|
||||
NudExpMargColumnsPerPage.Value = options.columnsPerPage;
|
||||
NudExpMargFontSize.Value = (decimal)options.fontSize;
|
||||
NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize;
|
||||
}
|
||||
|
||||
private void SavePdfExportOptions()
|
||||
{
|
||||
Settings._instance.pdfExport = new PdfExportSettings
|
||||
{
|
||||
cellPaddingTopMm = ReadDouble(NudExpMargCellPaddingTop),
|
||||
cellPaddingBottomMm = ReadDouble(NudExpMargCellPaddingBot),
|
||||
cellPaddingLeftMm = ReadDouble(NudExpMargCellPaddingLeft),
|
||||
cellPaddingRightMm = ReadDouble(NudExpMargCellPaddingRight),
|
||||
pageMarginTopMm = ReadDouble(TbExpMargMarginTop),
|
||||
pageMarginBottomMm = ReadDouble(TbExpMargMarginBottom),
|
||||
pageMarginLeftMm = ReadDouble(TbExpMargMarginLeft),
|
||||
pageMarginRightMm = ReadDouble(TbExpMargMarginRight),
|
||||
rowsPerPage = ReadInt(TbExpMargRowsPerPage, 7),
|
||||
columnsPerPage = ReadInt(NudExpMargColumnsPerPage, 3),
|
||||
fontSize = ReadDouble(NudExpMargFontSize),
|
||||
smallFontSize = ReadDouble(NudExpMargSmallFontSize)
|
||||
};
|
||||
|
||||
Settings.Save();
|
||||
}
|
||||
|
||||
private void PdfExportOption_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
||||
{
|
||||
SavePdfExportOptions();
|
||||
}
|
||||
|
||||
private double ReadDouble(NumericUpDown control)
|
||||
{
|
||||
return (double)(control.Value ?? 0);
|
||||
}
|
||||
|
||||
private int ReadInt(NumericUpDown control, int fallback)
|
||||
{
|
||||
return (int)Math.Round(control.Value ?? fallback);
|
||||
}
|
||||
|
||||
private NumericUpDown[] GetPdfExportControls()
|
||||
{
|
||||
return
|
||||
[
|
||||
NudExpMargCellPaddingTop,
|
||||
NudExpMargCellPaddingBot,
|
||||
NudExpMargCellPaddingLeft,
|
||||
NudExpMargCellPaddingRight,
|
||||
TbExpMargMarginTop,
|
||||
TbExpMargMarginBottom,
|
||||
TbExpMargMarginLeft,
|
||||
TbExpMargMarginRight,
|
||||
TbExpMargRowsPerPage,
|
||||
NudExpMargColumnsPerPage,
|
||||
NudExpMargFontSize,
|
||||
NudExpMargSmallFontSize
|
||||
];
|
||||
}
|
||||
|
||||
private void TbSettingsCustomerSenderAddress_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (LstSettingsCustomers.SelectedIndex == null || LstSettingsCustomers.SelectedIndex == -1) return;
|
||||
@@ -905,11 +1056,21 @@ public partial class MainWindow : Window
|
||||
private async void BtnWikiAddFile_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var result = await NamingWindow.Show(this);
|
||||
if (result != null)
|
||||
if (string.IsNullOrWhiteSpace(result)) return;
|
||||
|
||||
result = result.Trim();
|
||||
if (!result.EndsWith(".md", StringComparison.OrdinalIgnoreCase)) result += ".md";
|
||||
|
||||
if (!Directory.Exists(Global._instance.wiki_storage_path))
|
||||
Directory.CreateDirectory(Global._instance.wiki_storage_path);
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(Path.Combine(Global._instance.wiki_storage_path, result), "");
|
||||
PopulateNavTree();
|
||||
var targetDirectory = GetSelectedWikiTargetDirectory();
|
||||
Directory.CreateDirectory(targetDirectory);
|
||||
var newFilePath = Path.Combine(targetDirectory, result);
|
||||
File.WriteAllText(newFilePath, "");
|
||||
PopulateNavTree(targetDirectory, newFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -917,6 +1078,30 @@ public partial class MainWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private async void BtnWikiAddFolder_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var result = await NamingWindow.Show(this);
|
||||
if (string.IsNullOrWhiteSpace(result)) return;
|
||||
|
||||
result = result.Trim();
|
||||
|
||||
if (!Directory.Exists(Global._instance.wiki_storage_path))
|
||||
Directory.CreateDirectory(Global._instance.wiki_storage_path);
|
||||
|
||||
try
|
||||
{
|
||||
var targetDirectory = GetSelectedWikiTargetDirectory();
|
||||
var newFolderPath = Path.Combine(targetDirectory, result);
|
||||
Directory.CreateDirectory(newFolderPath);
|
||||
PopulateNavTree(targetDirectory, newFolderPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, ex.StackTrace, "Fehler");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void MnIAdSetRename_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LstCustomerAdressSets.SelectedItems.Count > 0)
|
||||
|
||||
@@ -37,7 +37,8 @@ public class CombineAddresses
|
||||
/// <returns></returns>
|
||||
public bool CompareAddresses(KasPerson first, KasPerson second, bool only_refsid = false)
|
||||
{
|
||||
if (first.refsid == second.refsid) return true;
|
||||
// A refsid of 0 means "missing", so it must not collapse unrelated entries.
|
||||
if (first.refsid != 0 && second.refsid != 0 && first.refsid == second.refsid) return true;
|
||||
if (!only_refsid)
|
||||
if (first.name == second.name &&
|
||||
first.anrede == second.anrede &&
|
||||
|
||||
+35
-50
@@ -11,36 +11,15 @@ namespace Logof_Client;
|
||||
|
||||
public class PdfBuilder
|
||||
{
|
||||
// Table layout
|
||||
private const int CellsPerRow = 3;
|
||||
private const int CellsPerPage = 21; // 3 columns × 7 rows
|
||||
private readonly PdfExportSettings _settings;
|
||||
private readonly XFont _boldFont;
|
||||
private readonly double _cellHeight = 42.43; // mm
|
||||
private readonly double _cellPaddingBottom = 5; // mm
|
||||
|
||||
// Padding inside cells
|
||||
private readonly double _cellPaddingLeft = 5; // mm
|
||||
private readonly double _cellPaddingTop = 5; // mm
|
||||
|
||||
// Cell dimensions (in mm)
|
||||
private readonly double _cellWidth = 70; // mm
|
||||
|
||||
// Font settings
|
||||
private readonly double _fontSize = 9;
|
||||
private readonly double _smallFontSize = 6;
|
||||
|
||||
private readonly double _marginBottom = 1; // mm
|
||||
|
||||
// Paper and layout settings
|
||||
private readonly double _marginLeft = 0; // mm
|
||||
private readonly double _marginRight = 0; // mm
|
||||
private readonly double _marginTop = 0; // mm
|
||||
private readonly XFont _regularFont;
|
||||
private readonly XFont _smallFont;
|
||||
|
||||
public PdfBuilder()
|
||||
public PdfBuilder(PdfExportSettings? settings = null)
|
||||
{
|
||||
EnsureFontResolverRegistered();
|
||||
_settings = settings ?? new PdfExportSettings();
|
||||
|
||||
// Select first font from build output fonts folder (AppContext.BaseDirectory/fonts)
|
||||
var chosenFamily = "Arial";
|
||||
@@ -58,9 +37,9 @@ public class PdfBuilder
|
||||
chosenFamily = "Arial";
|
||||
}
|
||||
|
||||
_boldFont = new XFont(chosenFamily, _fontSize, XFontStyleEx.Bold);
|
||||
_regularFont = new XFont(chosenFamily, _fontSize, XFontStyleEx.Regular);
|
||||
_smallFont = new XFont(chosenFamily, _smallFontSize, XFontStyleEx.Regular);
|
||||
_boldFont = new XFont(chosenFamily, _settings.fontSize, XFontStyleEx.Bold);
|
||||
_regularFont = new XFont(chosenFamily, _settings.fontSize, XFontStyleEx.Regular);
|
||||
_smallFont = new XFont(chosenFamily, _settings.smallFontSize, XFontStyleEx.Regular);
|
||||
}
|
||||
|
||||
private static void EnsureFontResolverRegistered()
|
||||
@@ -160,20 +139,17 @@ public class PdfBuilder
|
||||
|
||||
private void DrawPage(XGraphics gfx, List<string> addresses, ref int addressIndex)
|
||||
{
|
||||
var cellCount = 0;
|
||||
|
||||
for (var row = 0; row < 7; row++)
|
||||
for (var row = 0; row < _settings.rowsPerPage; row++)
|
||||
{
|
||||
for (var col = 0; col < 3; col++)
|
||||
for (var col = 0; col < _settings.columnsPerPage; col++)
|
||||
{
|
||||
if (addressIndex >= addresses.Count) break;
|
||||
|
||||
var x = MmToPoints(_marginLeft + col * _cellWidth);
|
||||
var y = MmToPoints(_marginTop + row * _cellHeight);
|
||||
var x = MmToPoints(_settings.pageMarginLeftMm + col * GetCellWidthMm());
|
||||
var y = MmToPoints(_settings.pageMarginTopMm + row * GetCellHeightMm());
|
||||
|
||||
DrawCell(gfx, x, y, addresses[addressIndex]);
|
||||
addressIndex++;
|
||||
cellCount++;
|
||||
}
|
||||
|
||||
if (addressIndex >= addresses.Count) break;
|
||||
@@ -183,13 +159,11 @@ public class PdfBuilder
|
||||
private void DrawPageWithPlaceholder(XGraphics gfx, List<string> addresses, ref int addressIndex,
|
||||
ref bool isFirstCell, string placeholderText)
|
||||
{
|
||||
var cellCount = 0;
|
||||
|
||||
for (var row = 0; row < 7; row++)
|
||||
for (var col = 0; col < 3; col++)
|
||||
for (var row = 0; row < _settings.rowsPerPage; row++)
|
||||
for (var col = 0; col < _settings.columnsPerPage; col++)
|
||||
{
|
||||
var x = MmToPoints(_marginLeft + col * _cellWidth);
|
||||
var y = MmToPoints(_marginTop + row * _cellHeight);
|
||||
var x = MmToPoints(_settings.pageMarginLeftMm + col * GetCellWidthMm());
|
||||
var y = MmToPoints(_settings.pageMarginTopMm + row * GetCellHeightMm());
|
||||
|
||||
// First cell: placeholder
|
||||
if (isFirstCell)
|
||||
@@ -206,15 +180,13 @@ public class PdfBuilder
|
||||
{
|
||||
DrawEmptyCell(gfx, x, y);
|
||||
}
|
||||
|
||||
cellCount++;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCell(XGraphics gfx, double x, double y, string? address)
|
||||
{
|
||||
var cellWidthPoints = MmToPoints(_cellWidth);
|
||||
var cellHeightPoints = MmToPoints(_cellHeight);
|
||||
var cellWidthPoints = MmToPoints(GetCellWidthMm());
|
||||
var cellHeightPoints = MmToPoints(GetCellHeightMm());
|
||||
|
||||
// Draw cell border
|
||||
var rect = new XRect(x, y, cellWidthPoints, cellHeightPoints);
|
||||
@@ -226,8 +198,8 @@ public class PdfBuilder
|
||||
|
||||
private void DrawEmptyCell(XGraphics gfx, double x, double y)
|
||||
{
|
||||
var cellWidthPoints = MmToPoints(_cellWidth);
|
||||
var cellHeightPoints = MmToPoints(_cellHeight);
|
||||
var cellWidthPoints = MmToPoints(GetCellWidthMm());
|
||||
var cellHeightPoints = MmToPoints(GetCellHeightMm());
|
||||
|
||||
var rect = new XRect(x, y, cellWidthPoints, cellHeightPoints);
|
||||
gfx.DrawRectangle(XPens.Black, rect);
|
||||
@@ -235,11 +207,12 @@ public class PdfBuilder
|
||||
|
||||
private void DrawMarkdownText(XGraphics gfx, string text, double x, double y, double cellWidth, double cellHeight)
|
||||
{
|
||||
var paddingLeftPoints = MmToPoints(_cellPaddingLeft);
|
||||
var paddingTopPoints = MmToPoints(_cellPaddingTop);
|
||||
var paddingBottomPoints = MmToPoints(_cellPaddingBottom);
|
||||
var paddingLeftPoints = MmToPoints(_settings.cellPaddingLeftMm);
|
||||
var paddingRightPoints = MmToPoints(_settings.cellPaddingRightMm);
|
||||
var paddingTopPoints = MmToPoints(_settings.cellPaddingTopMm);
|
||||
var paddingBottomPoints = MmToPoints(_settings.cellPaddingBottomMm);
|
||||
|
||||
var maxWidth = cellWidth - paddingLeftPoints * 2;
|
||||
var maxWidth = Math.Max(0, cellWidth - paddingLeftPoints - paddingRightPoints);
|
||||
|
||||
// Split text by newlines and remove empty trailing lines
|
||||
var rawLines = text.Split(new[] { "\n" }, StringSplitOptions.None);
|
||||
@@ -383,6 +356,18 @@ public class PdfBuilder
|
||||
return mm * 2.834645669;
|
||||
}
|
||||
|
||||
private double GetCellWidthMm()
|
||||
{
|
||||
var availableWidthMm = 210d - _settings.pageMarginLeftMm - _settings.pageMarginRightMm;
|
||||
return availableWidthMm / _settings.columnsPerPage;
|
||||
}
|
||||
|
||||
private double GetCellHeightMm()
|
||||
{
|
||||
var availableHeightMm = 297d - _settings.pageMarginTopMm - _settings.pageMarginBottomMm;
|
||||
return availableHeightMm / _settings.rowsPerPage;
|
||||
}
|
||||
|
||||
// Configuration methods to allow customization
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user