This commit is contained in:
buildautomation 2021-12-29 14:17:32 +05:30
Родитель 7d5a34c995
Коммит 5c7cd2fdcc
889 изменённых файлов: 0 добавлений и 296960 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,118 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.Licensing;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Syncfusion.SampleBrowser.UWP.DocIO
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
SyncfusionLicenseProvider.RegisterLicense(Common.DemoCommon.FindLicenseKey("Syncfusion.SampleBrowser.UWP.DocIO.SyncfusionLicense.txt"));
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
new SamplesConfiguration();
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Просмотреть файл

@ -1,776 +0,0 @@
#
# Add-AppxDevPackage.ps1 is a PowerShell script designed to install app
# packages created by Visual Studio for developers. To run this script from
# Explorer, right-click on its icon and choose "Run with PowerShell".
#
# Visual Studio supplies this script in the folder generated with its
# "Prepare Package" command. The same folder will also contain the app
# package (a .appx file), the signing certificate (a .cer file), and a
# "Dependencies" subfolder containing all the framework packages used by the
# app.
#
# This script simplifies installing these packages by automating the
# following functions:
# 1. Find the app package and signing certificate in the script directory
# 2. Prompt the user to acquire a developer license and to install the
# certificate if necessary
# 3. Find dependency packages that are applicable to the operating system's
# CPU architecture
# 4. Install the package along with all applicable dependencies
#
# All command line parameters are reserved for use internally by the script.
# Users should launch this script from Explorer.
#
# .Link
# http://go.microsoft.com/fwlink/?LinkId=243053
param(
[switch]$Force = $false,
[switch]$GetDeveloperLicense = $false,
[string]$CertificatePath = $null
)
$ErrorActionPreference = "Stop"
# The language resources for this script are placed in the
# "Add-AppDevPackage.resources" subfolder alongside the script. Since the
# current working directory might not be the directory that contains the
# script, we need to create the full path of the resources directory to
# pass into Import-LocalizedData
$ScriptPath = $null
try
{
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
$ScriptDir = Split-Path -Parent $ScriptPath
}
catch {}
if (!$ScriptPath)
{
PrintMessageAndExit $UiStrings.ErrorNoScriptPath $ErrorCodes.NoScriptPath
}
$LocalizedResourcePath = Join-Path $ScriptDir "Add-AppDevPackage.resources"
Import-LocalizedData -BindingVariable UiStrings -BaseDirectory $LocalizedResourcePath
$ErrorCodes = Data {
ConvertFrom-StringData @'
Success = 0
NoScriptPath = 1
NoPackageFound = 2
ManyPackagesFound = 3
NoCertificateFound = 4
ManyCertificatesFound = 5
BadCertificate = 6
PackageUnsigned = 7
CertificateMismatch = 8
ForceElevate = 9
LaunchAdminFailed = 10
GetDeveloperLicenseFailed = 11
InstallCertificateFailed = 12
AddPackageFailed = 13
ForceDeveloperLicense = 14
CertUtilInstallFailed = 17
CertIsCA = 18
BannedEKU = 19
NoBasicConstraints = 20
NoCodeSigningEku = 21
InstallCertificateCancelled = 22
BannedKeyUsage = 23
ExpiredCertificate = 24
'@
}
function PrintMessageAndExit($ErrorMessage, $ReturnCode)
{
Write-Host $ErrorMessage
if (!$Force)
{
Pause
}
exit $ReturnCode
}
#
# Warns the user about installing certificates, and presents a Yes/No prompt
# to confirm the action. The default is set to No.
#
function ConfirmCertificateInstall
{
$Answer = $host.UI.PromptForChoice(
"",
$UiStrings.WarningInstallCert,
[System.Management.Automation.Host.ChoiceDescription[]]@($UiStrings.PromptYesString, $UiStrings.PromptNoString),
1)
return $Answer -eq 0
}
#
# Validates whether a file is a valid certificate using CertUtil.
# This needs to be done before calling Get-PfxCertificate on the file, otherwise
# the user will get a cryptic "Password: " prompt for invalid certs.
#
function ValidateCertificateFormat($FilePath)
{
# certutil -verify prints a lot of text that we don't need, so it's redirected to $null here
certutil.exe -verify $FilePath > $null
if ($LastExitCode -lt 0)
{
PrintMessageAndExit ($UiStrings.ErrorBadCertificate -f $FilePath, $LastExitCode) $ErrorCodes.BadCertificate
}
# Check if certificate is expired
$cert = Get-PfxCertificate $FilePath
if (($cert.NotBefore -gt (Get-Date)) -or ($cert.NotAfter -lt (Get-Date)))
{
PrintMessageAndExit ($UiStrings.ErrorExpiredCertificate -f $FilePath) $ErrorCodes.ExpiredCertificate
}
}
#
# Verify that the developer certificate meets the following restrictions:
# - The certificate must contain a Basic Constraints extension, and its
# Certificate Authority (CA) property must be false.
# - The certificate's Key Usage extension must be either absent, or set to
# only DigitalSignature.
# - The certificate must contain an Extended Key Usage (EKU) extension with
# Code Signing usage.
# - The certificate must NOT contain any other EKU except Code Signing and
# Lifetime Signing.
#
# These restrictions are enforced to decrease security risks that arise from
# trusting digital certificates.
#
function CheckCertificateRestrictions
{
Set-Variable -Name BasicConstraintsExtensionOid -Value "2.5.29.19" -Option Constant
Set-Variable -Name KeyUsageExtensionOid -Value "2.5.29.15" -Option Constant
Set-Variable -Name EkuExtensionOid -Value "2.5.29.37" -Option Constant
Set-Variable -Name CodeSigningEkuOid -Value "1.3.6.1.5.5.7.3.3" -Option Constant
Set-Variable -Name LifetimeSigningEkuOid -Value "1.3.6.1.4.1.311.10.3.13" -Option Constant
$CertificateExtensions = (Get-PfxCertificate $CertificatePath).Extensions
$HasBasicConstraints = $false
$HasCodeSigningEku = $false
foreach ($Extension in $CertificateExtensions)
{
# Certificate must contain the Basic Constraints extension
if ($Extension.oid.value -eq $BasicConstraintsExtensionOid)
{
# CA property must be false
if ($Extension.CertificateAuthority)
{
PrintMessageAndExit $UiStrings.ErrorCertIsCA $ErrorCodes.CertIsCA
}
$HasBasicConstraints = $true
}
# If key usage is present, it must be set to digital signature
elseif ($Extension.oid.value -eq $KeyUsageExtensionOid)
{
if ($Extension.KeyUsages -ne "DigitalSignature")
{
PrintMessageAndExit ($UiStrings.ErrorBannedKeyUsage -f $Extension.KeyUsages) $ErrorCodes.BannedKeyUsage
}
}
elseif ($Extension.oid.value -eq $EkuExtensionOid)
{
# Certificate must contain the Code Signing EKU
$EKUs = $Extension.EnhancedKeyUsages.Value
if ($EKUs -contains $CodeSigningEkuOid)
{
$HasCodeSigningEKU = $True
}
# EKUs other than code signing and lifetime signing are not allowed
foreach ($EKU in $EKUs)
{
if ($EKU -ne $CodeSigningEkuOid -and $EKU -ne $LifetimeSigningEkuOid)
{
PrintMessageAndExit ($UiStrings.ErrorBannedEKU -f $EKU) $ErrorCodes.BannedEKU
}
}
}
}
if (!$HasBasicConstraints)
{
PrintMessageAndExit $UiStrings.ErrorNoBasicConstraints $ErrorCodes.NoBasicConstraints
}
if (!$HasCodeSigningEKU)
{
PrintMessageAndExit $UiStrings.ErrorNoCodeSigningEku $ErrorCodes.NoCodeSigningEku
}
}
#
# Performs operations that require administrative privileges:
# - Prompt the user to obtain a developer license
# - Install the developer certificate (if -Force is not specified, also prompts the user to confirm)
#
function DoElevatedOperations
{
if ($GetDeveloperLicense)
{
Write-Host $UiStrings.GettingDeveloperLicense
if ($Force)
{
PrintMessageAndExit $UiStrings.ErrorForceDeveloperLicense $ErrorCodes.ForceDeveloperLicense
}
try
{
Show-WindowsDeveloperLicenseRegistration
}
catch
{
$Error[0] # Dump details about the last error
PrintMessageAndExit $UiStrings.ErrorGetDeveloperLicenseFailed $ErrorCodes.GetDeveloperLicenseFailed
}
}
if ($CertificatePath)
{
Write-Host $UiStrings.InstallingCertificate
# Make sure certificate format is valid and usage constraints are followed
ValidateCertificateFormat $CertificatePath
CheckCertificateRestrictions
# If -Force is not specified, warn the user and get consent
if ($Force -or (ConfirmCertificateInstall))
{
# Add cert to store
certutil.exe -addstore TrustedPeople $CertificatePath
if ($LastExitCode -lt 0)
{
PrintMessageAndExit ($UiStrings.ErrorCertUtilInstallFailed -f $LastExitCode) $ErrorCodes.CertUtilInstallFailed
}
}
else
{
PrintMessageAndExit $UiStrings.ErrorInstallCertificateCancelled $ErrorCodes.InstallCertificateCancelled
}
}
}
#
# Checks whether the machine is missing a valid developer license.
#
function CheckIfNeedDeveloperLicense
{
$Result = $true
try
{
$Result = (Get-WindowsDeveloperLicense | Where-Object { $_.IsValid } | Measure-Object).Count -eq 0
}
catch {}
return $Result
}
#
# Launches an elevated process running the current script to perform tasks
# that require administrative privileges. This function waits until the
# elevated process terminates, and checks whether those tasks were successful.
#
function LaunchElevated
{
# Set up command line arguments to the elevated process
$RelaunchArgs = '-ExecutionPolicy Unrestricted -file "' + $ScriptPath + '"'
if ($Force)
{
$RelaunchArgs += ' -Force'
}
if ($NeedDeveloperLicense)
{
$RelaunchArgs += ' -GetDeveloperLicense'
}
if ($NeedInstallCertificate)
{
$RelaunchArgs += ' -CertificatePath "' + $DeveloperCertificatePath.FullName + '"'
}
# Launch the process and wait for it to finish
try
{
$AdminProcess = Start-Process "$PsHome\PowerShell.exe" -Verb RunAs -ArgumentList $RelaunchArgs -PassThru
}
catch
{
$Error[0] # Dump details about the last error
PrintMessageAndExit $UiStrings.ErrorLaunchAdminFailed $ErrorCodes.LaunchAdminFailed
}
while (!($AdminProcess.HasExited))
{
Start-Sleep -Seconds 2
}
# Check if all elevated operations were successful
if ($NeedDeveloperLicense)
{
if (CheckIfNeedDeveloperLicense)
{
PrintMessageAndExit $UiStrings.ErrorGetDeveloperLicenseFailed $ErrorCodes.GetDeveloperLicenseFailed
}
else
{
Write-Host $UiStrings.AcquireLicenseSuccessful
}
}
if ($NeedInstallCertificate)
{
$Signature = Get-AuthenticodeSignature $DeveloperPackagePath -Verbose
if ($Signature.Status -ne "Valid")
{
PrintMessageAndExit ($UiStrings.ErrorInstallCertificateFailed -f $Signature.Status) $ErrorCodes.InstallCertificateFailed
}
else
{
Write-Host $UiStrings.InstallCertificateSuccessful
}
}
}
#
# Finds all applicable dependency packages according to OS architecture, and
# installs the developer package with its dependencies. The expected layout
# of dependencies is:
#
# <current dir>
# \Dependencies
# <Architecture neutral dependencies>.appx\.msix
# \x86
# <x86 dependencies>.appx\.msix
# \x64
# <x64 dependencies>.appx\.msix
# \arm
# <arm dependencies>.appx\.msix
#
function InstallPackageWithDependencies
{
$DependencyPackagesDir = (Join-Path $ScriptDir "Dependencies")
$DependencyPackages = @()
if (Test-Path $DependencyPackagesDir)
{
# Get architecture-neutral dependencies
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "*.appx") | Where-Object { $_.Mode -NotMatch "d" }
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "*.msix") | Where-Object { $_.Mode -NotMatch "d" }
# Get architecture-specific dependencies
if (($Env:Processor_Architecture -eq "x86" -or $Env:Processor_Architecture -eq "amd64") -and (Test-Path (Join-Path $DependencyPackagesDir "x86")))
{
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "x86\*.appx") | Where-Object { $_.Mode -NotMatch "d" }
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "x86\*.msix") | Where-Object { $_.Mode -NotMatch "d" }
}
if (($Env:Processor_Architecture -eq "amd64") -and (Test-Path (Join-Path $DependencyPackagesDir "x64")))
{
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "x64\*.appx") | Where-Object { $_.Mode -NotMatch "d" }
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "x64\*.msix") | Where-Object { $_.Mode -NotMatch "d" }
}
if (($Env:Processor_Architecture -eq "arm") -and (Test-Path (Join-Path $DependencyPackagesDir "arm")))
{
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "arm\*.appx") | Where-Object { $_.Mode -NotMatch "d" }
$DependencyPackages += Get-ChildItem (Join-Path $DependencyPackagesDir "arm\*.msix") | Where-Object { $_.Mode -NotMatch "d" }
}
}
Write-Host $UiStrings.InstallingPackage
$AddPackageSucceeded = $False
try
{
if ($DependencyPackages.FullName.Count -gt 0)
{
Write-Host $UiStrings.DependenciesFound
$DependencyPackages.FullName
Add-AppxPackage -Path $DeveloperPackagePath.FullName -DependencyPath $DependencyPackages.FullName -ForceApplicationShutdown
}
else
{
Add-AppxPackage -Path $DeveloperPackagePath.FullName -ForceApplicationShutdown
}
$AddPackageSucceeded = $?
}
catch
{
$Error[0] # Dump details about the last error
}
if (!$AddPackageSucceeded)
{
if ($NeedInstallCertificate)
{
PrintMessageAndExit $UiStrings.ErrorAddPackageFailedWithCert $ErrorCodes.AddPackageFailed
}
else
{
PrintMessageAndExit $UiStrings.ErrorAddPackageFailed $ErrorCodes.AddPackageFailed
}
}
}
#
# Main script logic when the user launches the script without parameters.
#
function DoStandardOperations
{
# Check for an .appx or .msix file in the script directory
$PackagePath = Get-ChildItem (Join-Path $ScriptDir "*.appx") | Where-Object { $_.Mode -NotMatch "d" }
if ($PackagePath -eq $null)
{
$PackagePath = Get-ChildItem (Join-Path $ScriptDir "*.msix") | Where-Object { $_.Mode -NotMatch "d" }
}
$PackageCount = ($PackagePath | Measure-Object).Count
# Check for an .appxbundle or .msixbundle file in the script directory
$BundlePath = Get-ChildItem (Join-Path $ScriptDir "*.appxbundle") | Where-Object { $_.Mode -NotMatch "d" }
if ($BundlePath -eq $null)
{
$BundlePath = Get-ChildItem (Join-Path $ScriptDir "*.msixbundle") | Where-Object { $_.Mode -NotMatch "d" }
}
$BundleCount = ($BundlePath | Measure-Object).Count
# Check for an .eappx or .emsix file in the script directory
$EncryptedPackagePath = Get-ChildItem (Join-Path $ScriptDir "*.eappx") | Where-Object { $_.Mode -NotMatch "d" }
if ($EncryptedPackagePath -eq $null)
{
$EncryptedPackagePath = Get-ChildItem (Join-Path $ScriptDir "*.emsix") | Where-Object { $_.Mode -NotMatch "d" }
}
$EncryptedPackageCount = ($EncryptedPackagePath | Measure-Object).Count
# Check for an .eappxbundle or .emsixbundle file in the script directory
$EncryptedBundlePath = Get-ChildItem (Join-Path $ScriptDir "*.eappxbundle") | Where-Object { $_.Mode -NotMatch "d" }
if ($EncryptedBundlePath -eq $null)
{
$EncryptedBundlePath = Get-ChildItem (Join-Path $ScriptDir "*.emsixbundle") | Where-Object { $_.Mode -NotMatch "d" }
}
$EncryptedBundleCount = ($EncryptedBundlePath | Measure-Object).Count
$NumberOfPackages = $PackageCount + $EncryptedPackageCount
$NumberOfBundles = $BundleCount + $EncryptedBundleCount
# There must be at least one package or bundle
if ($NumberOfPackages + $NumberOfBundles -lt 1)
{
PrintMessageAndExit $UiStrings.ErrorNoPackageFound $ErrorCodes.NoPackageFound
}
# We must have exactly one bundle OR no bundle and exactly one package
elseif ($NumberOfBundles -gt 1 -or
($NumberOfBundles -eq 0 -and $NumberOfpackages -gt 1))
{
PrintMessageAndExit $UiStrings.ErrorManyPackagesFound $ErrorCodes.ManyPackagesFound
}
# First attempt to install a bundle or encrypted bundle. If neither exists, fall back to packages and then encrypted packages
if ($BundleCount -eq 1)
{
$DeveloperPackagePath = $BundlePath
Write-Host ($UiStrings.BundleFound -f $DeveloperPackagePath.FullName)
}
elseif ($EncryptedBundleCount -eq 1)
{
$DeveloperPackagePath = $EncryptedBundlePath
Write-Host ($UiStrings.EncryptedBundleFound -f $DeveloperPackagePath.FullName)
}
elseif ($PackageCount -eq 1)
{
$DeveloperPackagePath = $PackagePath
Write-Host ($UiStrings.PackageFound -f $DeveloperPackagePath.FullName)
}
elseif ($EncryptedPackageCount -eq 1)
{
$DeveloperPackagePath = $EncryptedPackagePath
Write-Host ($UiStrings.EncryptedPackageFound -f $DeveloperPackagePath.FullName)
}
# The package must be signed
$PackageSignature = Get-AuthenticodeSignature $DeveloperPackagePath
$PackageCertificate = $PackageSignature.SignerCertificate
if (!$PackageCertificate)
{
PrintMessageAndExit $UiStrings.ErrorPackageUnsigned $ErrorCodes.PackageUnsigned
}
# Test if the package signature is trusted. If not, the corresponding certificate
# needs to be present in the current directory and needs to be installed.
$NeedInstallCertificate = ($PackageSignature.Status -ne "Valid")
if ($NeedInstallCertificate)
{
# List all .cer files in the script directory
$DeveloperCertificatePath = Get-ChildItem (Join-Path $ScriptDir "*.cer") | Where-Object { $_.Mode -NotMatch "d" }
$DeveloperCertificateCount = ($DeveloperCertificatePath | Measure-Object).Count
# There must be exactly 1 certificate
if ($DeveloperCertificateCount -lt 1)
{
PrintMessageAndExit $UiStrings.ErrorNoCertificateFound $ErrorCodes.NoCertificateFound
}
elseif ($DeveloperCertificateCount -gt 1)
{
PrintMessageAndExit $UiStrings.ErrorManyCertificatesFound $ErrorCodes.ManyCertificatesFound
}
Write-Host ($UiStrings.CertificateFound -f $DeveloperCertificatePath.FullName)
# The .cer file must have the format of a valid certificate
ValidateCertificateFormat $DeveloperCertificatePath
# The package signature must match the certificate file
if ($PackageCertificate -ne (Get-PfxCertificate $DeveloperCertificatePath))
{
PrintMessageAndExit $UiStrings.ErrorCertificateMismatch $ErrorCodes.CertificateMismatch
}
}
$NeedDeveloperLicense = CheckIfNeedDeveloperLicense
# Relaunch the script elevated with the necessary parameters if needed
if ($NeedDeveloperLicense -or $NeedInstallCertificate)
{
Write-Host $UiStrings.ElevateActions
if ($NeedDeveloperLicense)
{
Write-Host $UiStrings.ElevateActionDevLicense
}
if ($NeedInstallCertificate)
{
Write-Host $UiStrings.ElevateActionCertificate
}
$IsAlreadyElevated = ([Security.Principal.WindowsIdentity]::GetCurrent().Groups.Value -contains "S-1-5-32-544")
if ($IsAlreadyElevated)
{
if ($Force -and $NeedDeveloperLicense)
{
PrintMessageAndExit $UiStrings.ErrorForceDeveloperLicense $ErrorCodes.ForceDeveloperLicense
}
if ($Force -and $NeedInstallCertificate)
{
Write-Warning $UiStrings.WarningInstallCert
}
}
else
{
if ($Force)
{
PrintMessageAndExit $UiStrings.ErrorForceElevate $ErrorCodes.ForceElevate
}
else
{
Write-Host $UiStrings.ElevateActionsContinue
Pause
}
}
LaunchElevated
}
InstallPackageWithDependencies
}
#
# Main script entry point
#
if ($GetDeveloperLicense -or $CertificatePath)
{
DoElevatedOperations
}
else
{
DoStandardOperations
PrintMessageAndExit $UiStrings.Success $ErrorCodes.Success
}
# SIG # Begin signature block
# MIIiYQYJKoZIhvcNAQcCoIIiUjCCIk4CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCD5BdpRggDM/3NT
# wBDQFaER9aOD9SdM3CUzPDQe6F3dFqCCC3IwggT6MIID4qADAgECAhMzAAACOJHL
# TMcR/c0FAAAAAAI4MA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTAwHhcNMTgwNzEyMjAwNzUxWhcNMTkwODA4MjAwNzUxWjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
# AQCxa4uSyF1bHBPpVz+I2OzZyDUl+7WGVOC4eGwcrFpO+VjIooh6/7VMiXpycBnB
# OHnhHi4JFVzh1lDthBX1SYvxdahlrdU/CVkzepCk8fRYwFqFJXSYrKYdx4M3MIYf
# G013XPp+phSG59ZJ+pDq+KXv07w4u5wQwNWWpqpvhMivvncFWRWFKKxopmJRYwuB
# TbsuIPuDlIGwqeZTtzQAaIC1bKI8B1IUnASfa7KT5jfu2DCsZZp4QkRRab8k5z43
# m0oPJjCPij3F5HdkPTeVB2VmRXX5qg5yC1S17WDHhdqZ6QyOXLS8PP2JI0xZqf2y
# Qxm3PtFtjqzIhhFVqo5ZE7qLAgMBAAGjggF5MIIBdTAfBgNVHSUEGDAWBgorBgEE
# AYI3PQYBBggrBgEFBQcDAzAdBgNVHQ4EFgQUffTinSOWhXPocryoJKARRYkMhlIw
# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1
# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzA4NjUrNDQwOTgyMB8GA1UdIwQYMBaAFOb8
# X3u7IgBY5HJOtfQhdCMy5u+sMFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwu
# bWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY0NvZFNpZ1BDQV8yMDEw
# LTA3LTA2LmNybDBaBggrBgEFBQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93
# d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljQ29kU2lnUENBXzIwMTAtMDct
# MDYuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQADggEBAJG95FfnxqX1
# Kig2ViU94js73K6XxqwEbAstERReU6CJ4UUbob6xC8T3z78eTWWQLhR580M/mI/l
# /PA3rB1/rHS4kxU5R1vayEm8ncMulj5jUinTmFaJFpJAQKSItu63DHEbxaEMjKcg
# Dn/4m813W62gwnATdqhmT9/yt5zADVz4z1Eq3AxINdkL0Y0rxnikXBjwcvRXHJtd
# vDEBsCKL/2YCFAa0saScYk/lfFd/j7JfXBWLP7/5MEtExz9GgyjOiIE782MRPmqv
# ki/1cojjJbGz66NS7GQcpJH5GGEWI51qwHoB/nhoABJq5WGooCaH7Ro0HVSyeIi4
# sCCPspQT8XswggZwMIIEWKADAgECAgphDFJMAAAAAAADMA0GCSqGSIb3DQEBCwUA
# MIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH
# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQD
# EylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0x
# MDA3MDYyMDQwMTdaFw0yNTA3MDYyMDUwMTdaMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDpDmRQ
# eWe1xOP9CQBMnpSs91Zo6kTYz8VYT6mldnxtRbrTOZK0pB75+WWC5BfSj/1EnAjo
# ZZPOLFWEv30I4y4rqEErGLeiS25JTGsVB97R0sKJHnGUzbV/S7SvCNjMiNZrF5Q6
# k84mP+zm/jSYV9UdXUn2siou1YW7WT/4kLQrg3TKK7M7RuPwRknBF2ZUyRy9HcRV
# Yldy+Ge5JSA03l2mpZVeqyiAzdWynuUDtWPTshTIwciKJgpZfwfs/w7tgBI1TBKm
# vlJb9aba4IsLSHfWhUfVELnG6Krui2otBVxgxrQqW5wjHF9F4xoUHm83yxkzgGqJ
# TaNqZmN4k9Uwz5UfAgMBAAGjggHjMIIB3zAQBgkrBgEEAYI3FQEEAwIBADAdBgNV
# HQ4EFgQU5vxfe7siAFjkck619CF0IzLm76wwGQYJKwYBBAGCNxQCBAweCgBTAHUA
# YgBDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU
# 1fZWy4/oolxiaNE9lJBb186aGMQwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2Ny
# bC5taWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIw
# MTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDov
# L3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0w
# Ni0yMy5jcnQwgZ0GA1UdIASBlTCBkjCBjwYJKwYBBAGCNy4DMIGBMD0GCCsGAQUF
# BwIBFjFodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vUEtJL2RvY3MvQ1BTL2RlZmF1
# bHQuaHRtMEAGCCsGAQUFBwICMDQeMiAdAEwAZQBnAGEAbABfAFAAbwBsAGkAYwB5
# AF8AUwB0AGEAdABlAG0AZQBuAHQALiAdMA0GCSqGSIb3DQEBCwUAA4ICAQAadO9X
# Tyl7xBaFeLhQ0yL8CZ2sgpf4NP8qLJeVEuXkv8+/k8jjNKnbgbjcHgC+0jVvr+V/
# eZV35QLU8evYzU4eG2GiwlojGvCMqGJRRWcI4z88HpP4MIUXyDlAptcOsyEp5aWh
# aYwik8x0mOehR0PyU6zADzBpf/7SJSBtb2HT3wfV2XIALGmGdj1R26Y5SMk3YW0H
# 3VMZy6fWYcK/4oOrD+Brm5XWfShRsIlKUaSabMi3H0oaDmmp19zBftFJcKq2rbty
# R2MX+qbWoqaG7KgQRJtjtrJpiQbHRoZ6GD/oxR0h1Xv5AiMtxUHLvx1MyBbvsZx/
# /CJLSYpuFeOmf3Zb0VN5kYWd1dLbPXM18zyuVLJSR2rAqhOV0o4R2plnXjKM+zeF
# 0dx1hZyHxlpXhcK/3Q2PjJst67TuzyfTtV5p+qQWBAGnJGdzz01Ptt4FVpd69+lS
# TfR3BU+FxtgL8Y7tQgnRDXbjI1Z4IiY2vsqxjG6qHeSF2kczYo+kyZEzX3EeQK+Y
# Zcki6EIhJYocLWDZN4lBiSoWD9dhPJRoYFLv1keZoIBA7hWBdz6c4FMYGlAdOJWb
# HmYzEyc5F3iHNs5Ow1+y9T1HU7bg5dsLYT0q15IszjdaPkBCMaQfEAjCVpy/JF1R
# Ap1qedIX09rBlI4HeyVxRKsGaubUxt8jmpZ1xTGCFkUwghZBAgEBMIGVMH4xCzAJ
# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jv
# c29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTACEzMAAAI4kctMxxH9zQUAAAAAAjgw
# DQYJYIZIAWUDBAIBBQCggcYwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYK
# KwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIEMB6sh3
# 0od0djZhSjYmDFfgME5hmf84vbeilDhjyyYCMFoGCisGAQQBgjcCAQwxTDBKoCyA
# KgBhAGQAZAAtAGEAcABwAGQAZQB2AHAAYQBjAGsAYQBnAGUALgBwAHMAMaEagBho
# dHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAdUM3MLh9
# 6Eak9c68SaNllKtfy+lkV8Z29Cf+cHdH1+V9OrIC4OlK1DPnkXeB4x7eUxmBbokE
# W6HtERJANy2SAzoHS9sLxtanuSUJqyNoa/lsAamu/GBuybDUiXfI9YdQA7YratSK
# qPwdvcaeTF/R5q6wju2loRaDmtD2GIKafNHCk9Oi1vcVEwrZRWBwSoncOtzXc1yJ
# cchKa5mDujYKkZ2DxXtF+5uofhPy+CsvqMbr9VqVZiJvcePUi8DGfk14fMdEQsT8
# yH9WEMhHJZOu71d7n1D7vlrXD5INZEL/V/8/oW1TOPhRKilMJ3nIq+uT9uNXt0C8
# hmHLLSYkYTlIVqGCE7cwghOzBgorBgEEAYI3AwMBMYITozCCE58GCSqGSIb3DQEH
# AqCCE5AwghOMAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFYBgsqhkiG9w0BCRABBKCC
# AUcEggFDMIIBPwIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCBGemR0
# iL8d117B6D/HI+xIBU0ywSzdqtXgA2PwmB9s/QIGW9uUBTPoGBMyMDE4MTExNTAx
# MTcwOC42NDhaMAcCAQGAAgH0oIHUpIHRMIHOMQswCQYDVQQGEwJVUzETMBEGA1UE
# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z
# b2Z0IENvcnBvcmF0aW9uMSkwJwYDVQQLEyBNaWNyb3NvZnQgT3BlcmF0aW9ucyBQ
# dWVydG8gUmljbzEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046QzBGNC0zMDg2LURF
# RjgxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2Wggg8fMIIE
# 9TCCA92gAwIBAgITMwAAANAcamBhwufhrQAAAAAA0DANBgkqhkiG9w0BAQsFADB8
# MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVk
# bW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1N
# aWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDAeFw0xODA4MjMyMDI2MjhaFw0x
# OTExMjMyMDI2MjhaMIHOMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3Rv
# bjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0
# aW9uMSkwJwYDVQQLEyBNaWNyb3NvZnQgT3BlcmF0aW9ucyBQdWVydG8gUmljbzEm
# MCQGA1UECxMdVGhhbGVzIFRTUyBFU046QzBGNC0zMDg2LURFRjgxJTAjBgNVBAMT
# HE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2UwggEiMA0GCSqGSIb3DQEBAQUA
# A4IBDwAwggEKAoIBAQCbPoY211rO+8Z9zCo8IAYVmps5IDy61+pDNMYTp0m8huVo
# rXo5SKMmKAYnE0C1sg6srmX5Q0s4a64HYRinDv2ly2HM2cU36hva3Ey1ZXtNkas6
# jSudX1Idqe3NuICGkOTGtydhBeSLWQ57tWx4c0/eFPyRb56B93OVe35gMirnNNUx
# G13+Z0PV52SRjGTZ+zUPZy7crK1UP8RNbKfHWd2PYZK6WSRv37Vd7ocqC79HbP1x
# Jb8pZLxTVCqWlfPokE1oZfKxmHTtBDlPyT1rGkqCgV97H/KWaAeXsy/WReXaWuaP
# VxJVCnpcEsRrgtfFmnSiNoEzu+fg7FIIBPXOkkYrAgMBAAGjggEbMIIBFzAdBgNV
# HQ4EFgQUA4Mol6hrJfLEUzIfma06vHcYxXEwHwYDVR0jBBgwFoAU1WM6XIoxkPND
# e3xGG8UzaFqFbVUwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3Nv
# ZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljVGltU3RhUENBXzIwMTAtMDctMDEu
# Y3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNy
# b3NvZnQuY29tL3BraS9jZXJ0cy9NaWNUaW1TdGFQQ0FfMjAxMC0wNy0wMS5jcnQw
# DAYDVR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcDCDANBgkqhkiG9w0BAQsF
# AAOCAQEApbwklmQJ31r0v5RTfzYZkW48IPXgYF18spdGCVoMGD7qK1GR5IXN0eTz
# TWNJTRpOkR4726dJ9trulEfwTDe9owtngVnUTTZco4j1Ba1hLnc0rcT1wZfbQc9b
# XWmhEI3KLobATjK7Stfz49VV9QvRgr3ldnqGGbY5miHg5CKOIGOr9XDFtT3ve9jT
# qJZl8qxJVoKfHcUidYdGwfAKj8zcMIrt0+aE9V7G00wTNV9duDIA5vazZAUkJh6v
# s+H2Hmsl0SreztcnLOuSGL5HwSJrenGPlBT4mEeZqRhdJWunQdNWfEGmN1ovQZs7
# KayRu9l5Oia8rM7wkXDVF9cE+cCBLDCCBnEwggRZoAMCAQICCmEJgSoAAAAAAAIw
# DQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n
# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y
# YXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhv
# cml0eSAyMDEwMB4XDTEwMDcwMTIxMzY1NVoXDTI1MDcwMTIxNDY1NVowfDELMAkG
# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx
# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z
# b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
# ggEKAoIBAQCpHQ28dxGKOiDs/BOX9fp/aZRrdFQQ1aUKAIKF++18aEssX8XD5WHC
# drc+Zitb8BVTJwQxH0EbGpUdzgkTjnxhMFmxMEQP8WCIhFRDDNdNuDgIs0Ldk6zW
# czBXJoKjRQ3Q6vVHgc2/JGAyWGBG8lhHhjKEHnRhZ5FfgVSxz5NMksHEpl3RYRNu
# KMYa+YaAu99h/EbBJx0kZxJyGiGKr0tkiVBisV39dx898Fd1rL2KQk1AUdEPnAY+
# Z3/1ZsADlkR+79BL/W7lmsqxqPJ6Kgox8NpOBpG2iAg16HgcsOmZzTznL0S6p/Tc
# ZL2kAcEgCZN4zfy8wMlEXV4WnAEFTyJNAgMBAAGjggHmMIIB4jAQBgkrBgEEAYI3
# FQEEAwIBADAdBgNVHQ4EFgQU1WM6XIoxkPNDe3xGG8UzaFqFbVUwGQYJKwYBBAGC
# NxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8w
# HwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186aGMQwVgYDVR0fBE8wTTBLoEmg
# R4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWlj
# Um9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEF
# BQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29D
# ZXJBdXRfMjAxMC0wNi0yMy5jcnQwgaAGA1UdIAEB/wSBlTCBkjCBjwYJKwYBBAGC
# Ny4DMIGBMD0GCCsGAQUFBwIBFjFodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vUEtJ
# L2RvY3MvQ1BTL2RlZmF1bHQuaHRtMEAGCCsGAQUFBwICMDQeMiAdAEwAZQBnAGEA
# bABfAFAAbwBsAGkAYwB5AF8AUwB0AGEAdABlAG0AZQBuAHQALiAdMA0GCSqGSIb3
# DQEBCwUAA4ICAQAH5ohRDeLG4Jg/gXEDPZ2joSFvs+umzPUxvs8F4qn++ldtGTCz
# wsVmyWrf9efweL3HqJ4l4/m87WtUVwgrUYJEEvu5U4zM9GASinbMQEBBm9xcF/9c
# +V4XNZgkVkt070IQyK+/f8Z/8jd9Wj8c8pl5SpFSAK84Dxf1L3mBZdmptWvkx872
# ynoAb0swRCQiPM/tA6WWj1kpvLb9BOFwnzJKJ/1Vry/+tuWOM7tiX5rbV0Dp8c6Z
# ZpCM/2pif93FSguRJuI57BlKcWOdeyFtw5yjojz6f32WapB4pm3S4Zz5Hfw42JT0
# xqUKloakvZ4argRCg7i1gJsiOCC1JeVk7Pf0v35jWSUPei45V3aicaoGig+JFrph
# pxHLmtgOR5qAxdDNp9DvfYPw4TtxCd9ddJgiCGHasFAeb73x4QDf5zEHpJM692VH
# eOj4qEir995yfmFrb3epgcunCaw5u+zGy9iCtHLNHfS4hQEegPsbiSpUObJb2sgN
# VZl6h3M7COaYLeqN4DMuEin1wC9UJyH3yKxO2ii4sanblrKnQqLJzxlBTeCG+Sqa
# oxFmMNO7dDJL32N79ZmKLxvHIa9Zta7cRDyXUHHXodLFVeNp3lfB0d4wwP3M5k37
# Db9dT+mdHhk4L7zPWAUu7w2gUDXa7wknHNWzfjUeCLraNtvTX4/edIhJEqGCA60w
# ggKVAgEBMIH+oYHUpIHRMIHOMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv
# cmF0aW9uMSkwJwYDVQQLEyBNaWNyb3NvZnQgT3BlcmF0aW9ucyBQdWVydG8gUmlj
# bzEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046QzBGNC0zMDg2LURFRjgxJTAjBgNV
# BAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2WiJQoBATAJBgUrDgMCGgUA
# AxUAKSkfi3FxMlc3Nr+9neHTozE+jpWggd4wgdukgdgwgdUxCzAJBgNVBAYTAlVT
# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK
# ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVy
# YXRpb25zIFB1ZXJ0byBSaWNvMScwJQYDVQQLEx5uQ2lwaGVyIE5UUyBFU046NTdG
# Ni1DMUUwLTU1NEMxKzApBgNVBAMTIk1pY3Jvc29mdCBUaW1lIFNvdXJjZSBNYXN0
# ZXIgQ2xvY2swDQYJKoZIhvcNAQEFBQACBQDfly+5MCIYDzIwMTgxMTE1MDczNTIx
# WhgPMjAxODExMTYwNzM1MjFaMHQwOgYKKwYBBAGEWQoEATEsMCowCgIFAN+XL7kC
# AQAwBwIBAAICI7wwBwIBAAICGp4wCgIFAN+YgTkCAQAwNgYKKwYBBAGEWQoEAjEo
# MCYwDAYKKwYBBAGEWQoDAaAKMAgCAQACAxbjYKEKMAgCAQACAwehIDANBgkqhkiG
# 9w0BAQUFAAOCAQEAH221+B031KGiJ+0V5zQtAgv156vI7l0RaV+um/XWKSyLJKGL
# p7a2tXChMfnwFU2Onhoaxgzt9fYRAZ9CbY2ilWG5yICTqWfS0QZ2xJzmwW9ME04X
# wk1niODGhLkFph5upj6zHfl/7Gr6YpgmtSaJovT7/Sme1AtQ0+LzuoZ1yxOjT4tq
# Iyn+UOFPyjIlzFtxDA/csnwkdPbKZlG54TLp8VartSH8Cg3dfNeuuXgPcxUWhcjP
# eFZloVS04yBFWsbyqiyX+IVWRI+F6WNCha2g1aYaIzLGcQ5NXDsKVGxq++BBoPMj
# trpoaHQ3b65S3Z5ekaZyr6GzeEqoERFL2dskwTGCAvUwggLxAgEBMIGTMHwxCzAJ
# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jv
# c29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAAA0BxqYGHC5+GtAAAAAADQMA0G
# CWCGSAFlAwQCAQUAoIIBMjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJ
# KoZIhvcNAQkEMSIEIPg0uZubtVU/ZUMv8xh7ZGfOf1J5YuH1i1qHMtt/rnPuMIHi
# BgsqhkiG9w0BCRACDDGB0jCBzzCBzDCBsQQUKSkfi3FxMlc3Nr+9neHTozE+jpUw
# gZgwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYw
# JAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAANAcamBh
# wufhrQAAAAAA0DAWBBQFqkRUcJbL4j0oeHPLFC0ZWW6PRzANBgkqhkiG9w0BAQsF
# AASCAQBSUtHbY0ZFNitkQyHY2GFIgEWoXRdxYkIMCu4+MqjaAnyLj8a6l10dyzf3
# ysIY0sEi7W5kVhnAt2esDcP5bxZmB/Q8Em6Oc/YOqvq0V2df3YE1ySWxW+w1DIH5
# fS3DD2HI+6QvveebT+lvpMK/4dfSF74f8O+FvYmqY+4TShwRXiV2bqpKXv4guZwE
# E1GDKDnzh7jGiPf0zBDlhfnvRTSn5e5wUkpfWqMSpgXuJejet17Co771OaGZnO7f
# WvQmebG2jFgXJ1tfzsv+zcvnkd2n3rowa5XwIUo/VdtKDCT5jZYNZ16nt5+jwVtq
# 2GaQwZvYKC3wsPaqYGyn8DHRzi8q
# SIG # End signature block

Просмотреть файл

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns = "http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
</ApplicationInsights>

Двоичные данные
DocIO/Assets/Export.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
DocIO/Assets/LockScreenLogo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/Assets/SplashScreen.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичные данные
DocIO/Assets/Square150x150Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
DocIO/Assets/Square44x44Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичные данные
DocIO/Assets/StoreLogo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/Assets/Wide310x150Logo.scale-200.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Просмотреть файл

@ -1,11 +0,0 @@
Syncfusion.SampleBrowser.UWP.Common.dll
Syncfusion.Licensing.dll
Syncfusion.SfAccordion.UWP.dll
Syncfusion.SfInput.UWP.dll
Syncfusion.SfShared.UWP.dll
Syncfusion.SfTabControl.UWP.dll
Syncfusion.DocIO.UWP.dll
Syncfusion.OfficeChart.UWP.dll
Syncfusion.Pdf.UWP.dll
Syncfusion.XlsIO.UWP.dll
Syncfusion.Licensing.dll

Двоичные данные
DocIO/DocIO/Assets/AdventureCycle.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 79 KiB

Двоичные данные
DocIO/DocIO/Assets/Apple.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.7 KiB

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Bookmark_Template.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/ContentControlTemplate.docx

Двоичный файл не отображается.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,258 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<EmployeesList>
<Employees>
<FirstName>Nancy</FirstName>
<LastName>Davolio</LastName>
<EmployeeID>1</EmployeeID>
<Extension>5467</Extension>
<Address>507 - 20th Ave. E. Apt. 2A</Address>
<City>Seattle</City>
<Country>USA</Country>
<Customers>
<CustomerID>ALFKI</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Alfreds Futterkiste</CompanyName>
<ContactName>Maria Anders</ContactName>
<City>Berlin</City>
<Country>Germany</Country>
<Orders>
<OrderID>10835</OrderID>
<CustomerID>ALFKI</CustomerID>
<OrderDate>1/15/1998</OrderDate>
<ShippedDate>1/21/1998</ShippedDate>
<RequiredDate>2/12/1998</RequiredDate>
</Orders>
<Orders>
<OrderID>10952</OrderID>
<CustomerID>ALFKI</CustomerID>
<OrderDate>3/16/1998</OrderDate>
<ShippedDate>3/24/1998</ShippedDate>
<RequiredDate>4/27/1998</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>ANTON</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Antonio Moreno Taquería</CompanyName>
<ContactName>Antonio Moreno</ContactName>
<City>México D.F.</City>
<Country>Mexico</Country>
<Orders>
<OrderID>10677</OrderID>
<CustomerID>ANTON</CustomerID>
<OrderDate>9/22/1997</OrderDate>
<ShippedDate>9/26/1997</ShippedDate>
<RequiredDate>10/20/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>AROUT</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Around the Horn</CompanyName>
<ContactName>Thomas Hardy</ContactName>
<City>London</City>
<Country>UK</Country>
<Orders>
<OrderID>10453</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>2/21/1997</OrderDate>
<ShippedDate>2/26/1997</ShippedDate>
<RequiredDate>3/21/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10558</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>6/4/1997</OrderDate>
<ShippedDate>6/10/1997</ShippedDate>
<RequiredDate>7/2/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10743</OrderID>
<CustomerID>AROUT</CustomerID>
<OrderDate>11/17/1997</OrderDate>
<ShippedDate>11/21/1997</ShippedDate>
<RequiredDate>12/15/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BOTTM</CustomerID>
<EmployeeID>1</EmployeeID>
<CompanyName>Bottom-Dollar Markets</CompanyName>
<ContactName>Elizabeth Lincoln</ContactName>
<City>Tsawassen</City>
<Country>Canada</Country>
<Orders>
<OrderID>10975</OrderID>
<CustomerID>BOTTM</CustomerID>
<OrderDate>3/25/1998</OrderDate>
<ShippedDate>3/27/1998</ShippedDate>
<RequiredDate>4/22/1998</RequiredDate>
</Orders>
<Orders>
<OrderID>11027</OrderID>
<CustomerID>BOTTM</CustomerID>
<OrderDate>4/16/1998</OrderDate>
<ShippedDate>4/20/1998</ShippedDate>
<RequiredDate>5/14/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
<Employees>
<FirstName>Andrew</FirstName>
<LastName>Fuller</LastName>
<EmployeeID>2</EmployeeID>
<Extension>3457</Extension>
<Address>908 W. Capital Way</Address>
<City>Tacoma</City>
<Country>USA</Country>
<Customers>
<CustomerID>BERGS</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Berglunds snabbköp</CompanyName>
<ContactName>Christina Berglund</ContactName>
<City>Luleå</City>
<Country>Sweden</Country>
<Orders>
<OrderID>10280</OrderID>
<CustomerID>BERGS</CustomerID>
<OrderDate>8/14/1996</OrderDate>
<ShippedDate>9/12/1996</ShippedDate>
<RequiredDate>9/11/1996</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BONAP</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Bon app'</CompanyName>
<ContactName>Laurence Lebihan</ContactName>
<City>Marseille</City>
<Country>France</Country>
<Orders>
<OrderID>10663</OrderID>
<CustomerID>BONAP</CustomerID>
<OrderDate>9/10/1997</OrderDate>
<ShippedDate>10/3/1997</ShippedDate>
<RequiredDate>9/24/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>ERNSH</CustomerID>
<EmployeeID>2</EmployeeID>
<CompanyName>Ernst Handel</CompanyName>
<ContactName>Roland Mendel</ContactName>
<City>Graz</City>
<Country>Austria</Country>
<Orders>
<OrderID>10368</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>11/29/1996</OrderDate>
<ShippedDate>12/2/1996</ShippedDate>
<RequiredDate>12/27/1996</RequiredDate>
</Orders>
<Orders>
<OrderID>10595</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>7/10/1997</OrderDate>
<ShippedDate>7/14/1997</ShippedDate>
<RequiredDate>8/7/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10990</OrderID>
<CustomerID>ERNSH</CustomerID>
<OrderDate>4/1/1998</OrderDate>
<ShippedDate>4/7/1998</ShippedDate>
<RequiredDate>5/13/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
<Employees>
<FirstName>Margaret</FirstName>
<LastName>Peacock</LastName>
<EmployeeID>3</EmployeeID>
<Extension>5176</Extension>
<Address>4110 Old Redmond Rd.</Address>
<City>Redmond</City>
<Country>USA</Country>
<Customers>
<CustomerID>ANATR</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Ana Trujillo Emparedados y helados</CompanyName>
<ContactName>Ana Trujillo</ContactName>
<City>México D.F.</City>
<Country>Mexico</Country>
<Orders>
<OrderID>10926</OrderID>
<CustomerID>ANATR</CustomerID>
<OrderDate>3/4/1998</OrderDate>
<ShippedDate>3/11/1998</ShippedDate>
<RequiredDate>4/1/1998</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>BLONP</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Blondel père et fils</CompanyName>
<ContactName>Frédérique Citeaux</ContactName>
<City>Strasbourg</City>
<Country>France</Country>
<Orders>
<OrderID>10360</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>11/22/1996</OrderDate>
<ShippedDate>12/2/1996</ShippedDate>
<RequiredDate>12/20/1996</RequiredDate>
</Orders>
<Orders>
<OrderID>10584</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>6/30/1997</OrderDate>
<ShippedDate>7/4/1997</ShippedDate>
<RequiredDate>7/28/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10628</OrderID>
<CustomerID>BLONP</CustomerID>
<OrderDate>8/12/1997</OrderDate>
<ShippedDate>8/20/1997</ShippedDate>
<RequiredDate>9/9/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>COMMI</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Comércio Mineiro</CompanyName>
<ContactName>Pedro Afonso</ContactName>
<City>São Paulo</City>
<Country>Brazil</Country>
<Orders>
<OrderID>10558</OrderID>
<CustomerID>COMMI</CustomerID>
<OrderDate>6/4/1997</OrderDate>
<ShippedDate>6/10/1997</ShippedDate>
<RequiredDate>7/2/1997</RequiredDate>
</Orders>
<Orders>
<OrderID>10542</OrderID>
<CustomerID>COMMI</CustomerID>
<OrderDate>5/1/1997</OrderDate>
<ShippedDate>5/7/1997</ShippedDate>
<RequiredDate>5/29/1997</RequiredDate>
</Orders>
</Customers>
<Customers>
<CustomerID>DRACD</CustomerID>
<EmployeeID>3</EmployeeID>
<CompanyName>Drachenblut Delikatessen</CompanyName>
<ContactName>Sven Ottlieb</ContactName>
<City>Aachen</City>
<Country>Germany</Country>
<Orders>
<OrderID>10955</OrderID>
<CustomerID>DRACD</CustomerID>
<OrderDate>3/16/1998</OrderDate>
<ShippedDate>3/24/1998</ShippedDate>
<RequiredDate>4/27/1998</RequiredDate>
</Orders>
</Customers>
</Employees>
</EmployeesList>

Двоичные данные
DocIO/DocIO/Assets/Excel_Template.xlsx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Grape.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.4 KiB

Двоичные данные
DocIO/DocIO/Assets/Image.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 19 KiB

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Letter Formatting_WP.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/MetroStudio1.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 13 KiB

Двоичные данные
DocIO/DocIO/Assets/MetroStudio2.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичные данные
DocIO/DocIO/Assets/MetroStudio3.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 21 KiB

Двоичные данные
DocIO/DocIO/Assets/Mountain-200.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
DocIO/DocIO/Assets/Mountain-300.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичные данные
DocIO/DocIO/Assets/Northwind.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 87 KiB

Двоичные данные
DocIO/DocIO/Assets/Northwind_logo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Просмотреть файл

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<SNO>1</SNO>
<ProductName>Côte de Blaye</ProductName>
<Sum>141.396</Sum>
</Product>
<Product>
<SNO>2</SNO>
<ProductName>Thüringer Rostbratwurst</ProductName>
<Sum>80.368</Sum>
</Product>
<Product>
<SNO>3</SNO>
<ProductName>Raclette Courdavault</ProductName>
<Sum>71.155</Sum>
</Product>
<Product>
<SNO>4</SNO>
<ProductName>Tarte au sucre </ProductName>
<Sum>47.234</Sum>
</Product>
<Product>
<SNO>5</SNO>
<ProductName>Camembert Pierrot </ProductName>
<Sum>46.825</Sum>
</Product>
<Product>
<SNO>6</SNO>
<ProductName>Gnocchi di nonna Alice</ProductName>
<Sum>42.593</Sum>
</Product>
<Product>
<SNO>7</SNO>
<ProductName>Manjimup Dried Apples</ProductName>
<Sum>41.819</Sum>
</Product>
<Product>
<SNO>8</SNO>
<ProductName>Alice Mutton</ProductName>
<Sum>32.698</Sum>
</Product>
<Product>
<SNO>9</SNO>
<ProductName>Carnarvon Tigers</ProductName>
<Sum>29.171</Sum>
</Product>
<Product>
<SNO>10</SNO>
<ProductName>Rössle Sauerkraut.</ProductName>
<Sum>25.696</Sum>
</Product>
</Products>

Двоичные данные
DocIO/DocIO/Assets/Road-550-W.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
DocIO/DocIO/Assets/Security Settings.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Soup.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.5 KiB

Двоичные данные
DocIO/DocIO/Assets/Template_Letter.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Template_Letter_WP.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Template_Report.doc

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/TrackChangesTemplate.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/WinFAQ.txt

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/Word to ODT.docx

Двоичный файл не отображается.

Двоичные данные
DocIO/DocIO/Assets/syncfusion_logo.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
DocIO/DocIO/Assets/wordtoodt.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.AutoShapesDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="AutoShapes" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates to create Autoshapes for Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,242 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class AutoShapesDemo : SampleLayout
{
public AutoShapesDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
AutoShapes.ClearValue(Grid.BackgroundProperty);
AutoShapes.ClearValue(Grid.PaddingProperty);
AutoShapes.Children.Clear();
AutoShapes.ColumnDefinitions.Clear();
AutoShapes.RowDefinitions.Clear();
AutoShapes = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//Initialize Word document
WordDocument doc = new WordDocument();
//Ensure Minimum
doc.EnsureMinimal();
//Append AutoShape
Shape shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
//Set horizontal alignment
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
//Set horizontal origin
shape.HorizontalOrigin = HorizontalOrigin.Page;
//Set vertical origin
shape.VerticalOrigin = VerticalOrigin.Page;
//Set vertical position
shape.VerticalPosition = 50;
//Set AllowOverlap to true for overlapping shapes
shape.WrapFormat.AllowOverlap = true;
//Set Fill Color
shape.FillFormat.Color = Color.Blue;
//Set Content vertical alignment
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
//Add Texbody contents to Shape
IWParagraph para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Requirement").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 95;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 140;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Orange;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Design").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 185;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 230;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Blue;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Execution").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 275;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 320;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.Violet;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Testing").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
shape = doc.LastParagraph.AppendShape(AutoShapeType.DownArrow, 45, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 365;
shape.WrapFormat.AllowOverlap = true;
shape = doc.LastParagraph.AppendShape(AutoShapeType.RoundedRectangle, 130, 45);
shape.HorizontalAlignment = ShapeHorizontalAlignment.Center;
shape.HorizontalOrigin = HorizontalOrigin.Page;
shape.VerticalOrigin = VerticalOrigin.Page;
shape.VerticalPosition = 410;
shape.WrapFormat.AllowOverlap = true;
shape.FillFormat.Color = Color.PaleVioletRed;
shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle;
para = shape.TextBody.AddParagraph();
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
para.AppendText("Release").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Color.White, FontSize = 12, FontName = "Verdana" });
SaveDocx(doc);
}
/// <summary>
/// Save as Docx Format
/// </summary>
/// <param name="doc"></param>
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,45 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.BarChartDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="BarChart" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample illustrates inserting bar chart into a Word document with data from an existing Excel file." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="12" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock7" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,187 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.OfficeChart;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace EssentialDocIO
{
public sealed partial class BarChartDemo : SampleLayout
{
public BarChartDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
BarChart.Margin = new Thickness(10, 10, 10, 10);
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
BarChart.ClearValue(Grid.BackgroundProperty);
BarChart.ClearValue(Grid.PaddingProperty);
BarChart.Children.Clear();
BarChart.ColumnDefinitions.Clear();
BarChart.RowDefinitions.Clear();
BarChart = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(BarChartDemo).GetTypeInfo().Assembly;
//A new document is created.
WordDocument document = new WordDocument();
//Add new section to the Word document
IWSection section = document.AddSection();
//Set page margins of the section
section.PageSetup.Margins.All = 72;
//Add new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Apply heading style to the title paragraph
paragraph.ApplyStyle(BuiltinStyle.Heading1);
//Apply center alignment to the paragraph
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
//Append text to the paragraph
paragraph.AppendText("Northwind Management Report").CharacterFormat.TextColor = Syncfusion.DocIO.DLS.Color.FromArgb(46, 116, 181);
//Add new paragraph
paragraph = section.AddParagraph();
//Set before spacing to the paragraph
paragraph.ParagraphFormat.BeforeSpacing = 20;
//Load the excel template as stream
Stream excelStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Excel_Template.xlsx");
//Create and Append chart to the paragraph with excel stream as parameter
WChart barChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300);
//Set chart data
barChart.ChartType = OfficeChartType.Bar_Clustered;
barChart.ChartTitle = "Purchase Details";
barChart.ChartTitleArea.FontName = "Calibri (Body)";
barChart.ChartTitleArea.Size = 14;
//Set name to chart series
barChart.Series[0].Name = "Sum of Purchases";
barChart.Series[1].Name = "Sum of Future Expenses";
//Set Chart Data table
barChart.HasDataTable = true;
barChart.DataTable.HasBorders = true;
barChart.DataTable.HasHorzBorder = true;
barChart.DataTable.HasVertBorder = true;
barChart.DataTable.ShowSeriesKeys = true;
barChart.HasLegend = false;
//Setting background color
barChart.ChartArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(208, 206, 206);
barChart.PlotArea.Fill.ForeColor = Syncfusion.Drawing.Color.FromArgb(208, 206, 206);
//Setting line pattern to the chart area
barChart.PrimaryCategoryAxis.Border.LinePattern = OfficeChartLinePattern.None;
barChart.PrimaryValueAxis.Border.LinePattern = OfficeChartLinePattern.None;
barChart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None;
barChart.PrimaryValueAxis.MajorGridLines.Border.LineColor = Syncfusion.Drawing.Color.FromArgb(175, 171, 171);
//Set label for primary catagory axis
barChart.PrimaryCategoryAxis.CategoryLabels = barChart.ChartData[2, 1, 6, 1];
#region Saving Document
SaveDocx(document);
#endregion
}
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.BookmarkNavigationDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="BookmarkNavigatioin" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates the bookmark navigation in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="5" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock7" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="9" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock8" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<TextBlock x:Name="TextBlock9" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button2" Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="4" Content="View Template" Click="Button_Click_2" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10"/>
<Button x:Name="Button1" Grid.Row="12" Grid.Column="1" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock10" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,411 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class BookmarkNavigationDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
Button2.Click -= Button_Click_2;
DisposeButton(Button2);
Button2 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
BookmarkNavigatioin.ClearValue(Grid.BackgroundProperty);
BookmarkNavigatioin.ClearValue(Grid.PaddingProperty);
BookmarkNavigatioin.Children.Clear();
BookmarkNavigatioin.ColumnDefinitions.Clear();
BookmarkNavigatioin.RowDefinitions.Clear();
BookmarkNavigatioin = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private async void Button_Click_2(object sender, RoutedEventArgs e)
{
Assembly execAssm = typeof(BookmarkNavigationDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Bookmark_Template.docx");
MemoryStream stream = new MemoryStream();
inputStream.CopyTo(stream);
inputStream.Dispose();
stream.Position = 0;
ViewTemplate(stream);
}
public BookmarkNavigationDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
BookmarkNavigatioin.Margin = new Thickness(10, 10, 10, 10);
stackPnlOptions.Visibility = Visibility.Collapsed;
TextBlock5.Visibility = Visibility.Collapsed;
TextBlock6.Visibility = Visibility.Collapsed;
TextBlock7.Visibility = Visibility.Collapsed;
TextBlock4.Visibility = Visibility.Collapsed;
}
else
{
stackPnlOptions.Visibility = Visibility.Visible;
TextBlock6.Visibility = Visibility.Visible;
TextBlock5.Visibility = Visibility.Visible;
TextBlock7.Visibility = Visibility.Visible;
}
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(BookmarkNavigationDemo).GetTypeInfo().Assembly;
// Creating a new document.
WordDocument document = new WordDocument();
//Adds section with one empty paragraph to the Word document
document.EnsureMinimal();
//sets the page margins
document.LastSection.PageSetup.Margins.All = 72f;
//Appends bookmark to the paragraph
document.LastParagraph.AppendBookmarkStart("NorthwindDatabase");
document.LastParagraph.AppendText("Northwind database with relational data");
document.LastParagraph.AppendBookmarkEnd("NorthwindDatabase");
// Open an existing template document with single section.
WordDocument nwdInformation = new WordDocument();
Stream inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Bookmark_Template.docx");
// Open an existing template document.
await nwdInformation.OpenAsync(inputStream, FormatType.Doc);
inputStream.Dispose();
// Open an existing template document with multiple section.
WordDocument templateDocument = new WordDocument();
inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.BkmkDocumentPart_Template.docx");
// Open an existing template document.
await templateDocument.OpenAsync(inputStream, FormatType.Doc);
inputStream.Dispose();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the template document.
BookmarksNavigator bk = new BookmarksNavigator(templateDocument);
// Move to the NorthWind bookmark in template document
bk.MoveToBookmark("NorthWind");
//Gets the bookmark content as WordDocumentPart
WordDocumentPart documentPart = bk.GetContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the Northwind information document.
bk = new BookmarksNavigator(nwdInformation);
// Move to the information bookmark
bk.MoveToBookmark("Information");
// Get the content of information bookmark.
TextBodyPart bodyPart = bk.GetBookmarkContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the destination document.
bk = new BookmarksNavigator(document);
// Move to the NorthWind database in the destination document
bk.MoveToBookmark("NorthwindDatabase");
//Replace the bookmark content using word document parts
bk.ReplaceContent(documentPart);
// Move to the Northwind_Information in the destination document
bk.MoveToBookmark("Northwind_Information");
// Replacing content of Northwind_Information bookmark.
bk.ReplaceBookmarkContent(bodyPart);
#region Bookmark selection for table
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the Northwind information document.
bk = new BookmarksNavigator(nwdInformation);
bk.MoveToBookmark("SuppliersTable");
//Sets the column index where the bookmark starts within the table
bk.CurrentBookmark.FirstColumn = 1;
//Sets the column index where the bookmark ends within the table
bk.CurrentBookmark.LastColumn = 5;
// Get the content of suppliers table bookmark.
bodyPart = bk.GetBookmarkContent();
// Creating a bookmark navigator. Which help us to navigate through the
// bookmarks in the destination document.
bk = new BookmarksNavigator(document);
bk.MoveToBookmark("Table");
bk.ReplaceBookmarkContent(bodyPart);
#endregion
// Move to the text bookmark
bk.MoveToBookmark("Text");
//Deletes the bookmark content
bk.DeleteBookmarkContent(true);
// Inserting text inside the bookmark. This will preserve the source formatting
bk.InsertText("Northwind Database contains the following table:");
#region tableinsertion
WTable tbl = new WTable(document);
tbl.TableFormat.Borders.BorderType = BorderStyle.None;
tbl.TableFormat.IsAutoResized = true;
tbl.ResetCells(8, 2);
IWParagraph paragraph;
tbl.Rows[0].IsHeader = true;
paragraph = tbl[0, 0].AddParagraph();
paragraph.AppendText("Suppliers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[0, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[1, 0].AddParagraph();
paragraph.AppendText("Customers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[1, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[2, 0].AddParagraph();
paragraph.AppendText("Employees");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[2, 1].AddParagraph();
paragraph.AppendText("3");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[3, 0].AddParagraph();
paragraph.AppendText("Products");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[3, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[4, 0].AddParagraph();
paragraph.AppendText("Inventory");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[4, 1].AddParagraph();
paragraph.AppendText("2");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[5, 0].AddParagraph();
paragraph.AppendText("Shippers");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[5, 1].AddParagraph();
paragraph.AppendText("1");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[6, 0].AddParagraph();
paragraph.AppendText("PO Transactions");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[6, 1].AddParagraph();
paragraph.AppendText("3");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[7, 0].AddParagraph();
paragraph.AppendText("Sales Transactions");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
paragraph = tbl[7, 1].AddParagraph();
paragraph.AppendText("7");
paragraph.BreakCharacterFormat.FontName = "Calibri";
paragraph.BreakCharacterFormat.FontSize = 10;
bk.InsertTable(tbl);
#endregion
//Move to image bookmark
bk.MoveToBookmark("Image");
//Deletes the bookmark
bk.DeleteBookmarkContent(true);
// Inserting image to the bookmark.
IWPicture pic = bk.InsertParagraphItem(ParagraphItemType.Picture) as WPicture;
inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind.png");
pic.LoadImage(inputStream);
inputStream.Dispose();
pic.WidthScale = 50f; // It reduce the image size because it don't fit
pic.HeightScale = 75f; // in document page.
Save(rdDoc.IsChecked == true, document);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Bookmark Navigation";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
private async void ViewTemplate(MemoryStream stream)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Bookmark_Template";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("Bookmark_Template.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.CreateEquationDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="CreateEquation" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates how to create a Word document with mathematical equations using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,729 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CreateEquationDemo : SampleLayout
{
public CreateEquationDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
CreateEquation.ClearValue(Grid.BackgroundProperty);
CreateEquation.ClearValue(Grid.PaddingProperty);
CreateEquation.Children.Clear();
CreateEquation.ColumnDefinitions.Clear();
CreateEquation.RowDefinitions.Clear();
CreateEquation = null;
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//Creates a new word document instance
WordDocument document = new WordDocument();
//Adds new section to the document
IWSection section = document.AddSection();
//Sets page margins
document.LastSection.PageSetup.Margins.All = 72;
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Appends text to paragraph
IWTextRange textRange = paragraph.AppendText("Mathematical equations");
textRange.CharacterFormat.FontSize = 28;
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
paragraph.ParagraphFormat.AfterSpacing = 12;
#region Sum to the power of n
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of the sum (1+X) to the power of n.");
//Creates an equation with sum to the power of N
CreateSumToThePowerOfN(paragraph);
#endregion
#region Fourier series
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is a Fourier series for the function of period 2L");
//Creates a Fourier series equation
CreateFourierseries(paragraph);
#endregion
#region Triple scalar product
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of triple scalar product");
//Creates a triple scalar product equation
CreateTripleScalarProduct(paragraph);
#endregion
#region Gamma function
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of gamma function");
//Creates a gamma function equation
CreateGammaFunction(paragraph);
#endregion
#region Vector relation
//Adds new paragraph to the section
paragraph = AddParagraph(section, "This is an expansion of vector relation ");
//Creates a vector relation equation
CreateVectorRelation(paragraph);
#endregion
SaveDocx(document);
}
/// <summary>
/// Save as Docx Format
/// </summary>
/// <param name="doc"></param>
private async void SaveDocx(WordDocument doc)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await doc.SaveAsync(stream, FormatType.Docx);
doc.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
#region Helper Methods
/// <summary>
/// Adds new paragraph into the section
/// </summary>
/// <param name="section">Represents a section in Word document</param>
/// <param name="text">Represents a text to append in paragraph</param>
/// <returns>Returns a paragraph to add equation</returns>
private IWParagraph AddParagraph(IWSection section, string text)
{
//Adds new paragraph to the section
IWParagraph paragraph = section.AddParagraph();
//Adds new paragraph to add text
paragraph = section.AddParagraph();
//Appends text to paragraph
paragraph.AppendText(text);
paragraph.ParagraphFormat.AfterSpacing = 12;
paragraph.ParagraphFormat.BeforeSpacing = 12;
//Adds new paragraph to add equation
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 12;
return paragraph;
}
/// <summary>
/// Creates an expansion of triple scalar product
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateTripleScalarProduct(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a MathML element
WMath math = paragraph.AppendMath();
//Adds an office math
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
#region Math text
//Unicode value of middle dot
string middleDot = "\u00B7";
string multiplicationSign = "\u00D7";
string text = "A" + middleDot + "B" + multiplicationSign + "C";
//Adds a math item
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, text);
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
officeMathParaItem = AddMathText(document, officeMath, "=");
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
text = "A" + multiplicationSign + "B" + middleDot + "C";
officeMathParaItem = AddMathText(document, officeMath, text);
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Bold;
//Adds math text
officeMathParaItem = AddMathText(document, officeMath, "=");
#endregion
#region Delimiter
//Adds a delimiter
IOfficeMathDelimiter mathDelimiter = officeMath.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Sets begin character for delimiter
mathDelimiter.BeginCharacter = "|";
//Sets end character for delimiter
mathDelimiter.EndCharacter = "|";
//Apply formats for delimiter
mathDelimiter.ControlProperties = new WCharacterFormat(document);
(mathDelimiter.ControlProperties as WCharacterFormat).Italic = true;
//Adds arguments for delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
#region Matrix
//Add matrix into delimiter
IOfficeMathMatrix mathMatrix = officeMath.Functions.Add(MathFunctionType.Matrix) as IOfficeMathMatrix;
//Add columns in matrix
mathMatrix.Columns.Add();
mathMatrix.Columns.Add();
mathMatrix.Columns.Add();
#region First row
//Adds a new row
IOfficeMathMatrixRow mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "A");
#endregion
#region Second row
//Adds a new row
mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "B");
#endregion
#region Third row
//Adds a new row
mathMatrixRow = mathMatrix.Rows.Add();
///Add values to row
AddMatrixRowValues(document, mathMatrixRow, "C");
#endregion
#endregion
#endregion
}
/// <summary>
/// Creates an expansion of vector relation
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateVectorRelation(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a MathML element
WMath math = paragraph.AppendMath();
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds an accent equation
AddMathAccent(document, officeMath, 8407, "A");
//Adds a math text
string middleDot = "\u00B7";
officeMath = math.MathParagraph.Maths.Add();
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, middleDot);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "B");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
string multiplicationSign = "\u00D7";
officeMathParaItem = AddMathText(document, officeMath, multiplicationSign);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "C");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, "=");
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "A");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, multiplicationSign);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "B");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, middleDot);
//Adds an accent equation
officeMath = math.MathParagraph.Maths.Add();
AddMathAccent(document, officeMath, 8407, "C");
}
/// <summary>
/// Converts short value to string
/// </summary>
/// <param name="value">Represents a short value</param>
private static string ConvertShortToString(short value)
{
char chrValue = Convert.ToChar(value);
string strValue = Convert.ToString(chrValue);
return strValue;
}
/// <summary>
/// Creates an equation with sum to the power of N
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateSumToThePowerOfN(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds a math script element
IOfficeMathScript mathScript = AddMathScript(officeMath, MathScriptType.Superscript);
#region Delimiter equation
//Adds a delimiter
IOfficeMathDelimiter mathDelimiter = mathScript.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds an office math in the delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math text
IOfficeMathRunElement mathParaItem = AddMathText(document, officeMath, "1+x");
//Adds a math text
mathParaItem = AddMathText(document, mathScript.Script, "n");
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add(1);
mathParaItem = AddMathText(document, officeMath, "=1+");
#region Fraction equation
//Adds a math fraction
IOfficeMathFraction mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a numerator text
AddMathText(document, mathFraction.Numerator, "nx");
//Adds a denominator text
AddMathText(document, mathFraction.Denominator, "1!");
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
mathParaItem = AddMathText(document, officeMath, "+");
#region Fraction equation
//Adds a math fraction
mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
#region Numerator
//Adds a numerator text
AddMathText(document, mathFraction.Numerator, "n");
//Adds a delimiter
mathDelimiter = mathFraction.Numerator.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a math text for delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
AddMathText(document, officeMath, "n-1");
//Adds a math script
mathScript = mathFraction.Numerator.Functions.Add(MathFunctionType.SubSuperscript) as IOfficeMathScript;
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "x");
AddMathText(document, mathScript.Script, "2");
#endregion
#region Denominator
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "2!");
#endregion
#endregion
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
AddMathText(document, officeMath, "+...");
}
/// <summary>
/// Creates an expansion of Gamma function
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateGammaFunction(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
//Adds a math text
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Unicode value of capital gamma
string capitalGamma = "\u0393";
IOfficeMathRunElement officeMathParaItem = AddMathText(document, officeMath, capitalGamma);
//Sets MathML style format for the text
officeMathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a delimiter equation
IOfficeMathDelimiter mathDelimiter = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a equation to the delimiter
officeMath = mathDelimiter.Equation.Add();
//Adds a math text
officeMathParaItem = AddMathText(document, officeMath, "z");
//Adds a math text
officeMath = math.MathParagraph.Maths.Add();
officeMathParaItem = AddMathText(document, officeMath, "=");
//Adds an n array element
IOfficeMathNArray mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "0");
//Adds a math text
string infinitySymbol = "\u221E";
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math superscript
IOfficeMathScript mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "t");
AddMathText(document, mathScript.Script, "z-1");
//Adds a Superscript
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "-t");
//Adds a math text in n Array equation
AddMathText(document, mathNAry.Equation, "dt");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), "=");
//Adds a fraction equation
IOfficeMathFraction mathFraction = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math script
mathScript = AddMathScript(mathFraction.Numerator, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "-");
//Unicode of small gamma
string smallGamma = "\u03B3";
AddMathText(document, mathScript.Script, smallGamma);
AddMathText(document, mathScript.Script, "z");
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "z");
//Adds an n-array element
mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Unicode value of n-array product
string symbol = "\u220F";
//Adds a n-array character
mathNAry.NArrayCharacter = symbol;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "k=1");
//Adds a math text
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math script
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math delimiter element
mathDelimiter = mathScript.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a equation to the delimiter equation collection
officeMath = mathDelimiter.Equation.Add();
//Adds a math text
AddMathText(document, officeMath, "1+");
//Adds a fraction element
mathFraction = officeMath.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text for numerator
AddMathText(document, mathFraction.Numerator, "z");
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "k");
//Adds a math text
AddMathText(document, mathScript.Script, "-1");
//Adds a Superscript equation
mathScript = AddMathScript(mathNAry.Equation, MathScriptType.Superscript);
//Adds a math text for Superscript
AddMathText(document, mathScript.Equation, "e");
AddMathText(document, mathScript.Script, "z");
officeMathParaItem = AddMathText(document, mathScript.Script, "/");
officeMathParaItem.MathFormat.HasLiteral = true;
AddMathText(document, mathScript.Script, "k");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), ",");
//Adds a math text
officeMathParaItem = AddMathText(document, math.MathParagraph.Maths.Add(), " ");
//Sets style for math text
officeMathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), smallGamma);
string text = "\u2248" + "0.577216";
AddMathText(document, math.MathParagraph.Maths.Add(), text);
}
/// <summary>
/// Creates a Fourier series equation
/// </summary>
/// <param name="paragraph">Represents a paragraph to add MathML element</param>
private void CreateFourierseries(IWParagraph paragraph)
{
WordDocument document = paragraph.Document;
//Creates a new MathML element
WMath math = paragraph.AppendMath();
//Adds a math
IOfficeMath officeMath = math.MathParagraph.Maths.Add();
//Adds a math text
AddMathText(document, officeMath, "f");
//Adds a math delimiter
IOfficeMathDelimiter mathDelimiter = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds a math in the delimiter
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math text
AddMathText(document, officeMath, "x");
AddMathText(document, math.MathParagraph.Maths.Add(), "=");
//Adds a Subscript equation
IOfficeMathScript mathScript = AddMathScript(math.MathParagraph.Maths.Add(), MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "a");
AddMathText(document, mathScript.Script, "0");
//Adds a math text
AddMathText(document, math.MathParagraph.Maths.Add(), "+");
//Adds a math n-array
IOfficeMathNArray mathNAry = math.MathParagraph.Maths.Add().Functions.Add(MathFunctionType.NArray) as IOfficeMathNArray;
//Unicode value of n-array summation
string sigma = "\u2211";
//Sets the value as the n-array character
mathNAry.NArrayCharacter = sigma;
mathNAry.HasGrow = true;
//Adds a math text
AddMathText(document, mathNAry.Subscript, "n=1");
//Adds a math text
string infinitySymbol = "\u221E";
AddMathText(document, mathNAry.Superscript, infinitySymbol);
//Adds a math delimiter
mathDelimiter = mathNAry.Equation.Functions.Add(MathFunctionType.Delimiter) as IOfficeMathDelimiter;
//Adds an math in the delimiter equation collection
officeMath = mathDelimiter.Equation.Add() as IOfficeMath;
//Adds a math script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "a");
//Adds a math text
AddMathText(document, mathScript.Script, "n");
//Adds a math function
IOfficeMathFunction mathFunction = officeMath.Functions.Add(MathFunctionType.Function) as IOfficeMathFunction;
//Adds a math text
IOfficeMathRunElement mathParaItem = AddMathText(document, mathFunction.FunctionName, "cos");
mathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math fraction
IOfficeMathFraction mathFraction = mathFunction.Equation.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text
//Unicode value of PI
string pi = "\uD835\uDF0B";
string text = "n" + pi + "x";
AddMathText(document, mathFraction.Numerator, text);
AddMathText(document, mathFraction.Denominator, "L");
//Adds a math text
AddMathText(document, officeMath, "+");
//Adds a math script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
AddMathText(document, mathScript.Equation, "b");
AddMathText(document, mathScript.Script, "n");
//Adds a function
mathFunction = officeMath.Functions.Add(MathFunctionType.Function) as IOfficeMathFunction;
//Adds a math text
mathParaItem = AddMathText(document, mathFunction.FunctionName, "sin");
mathParaItem.MathFormat.Style = MathStyleType.Regular;
//Adds a math fraction element
mathFraction = mathFunction.Equation.Functions.Add(MathFunctionType.Fraction) as IOfficeMathFraction;
//Adds a math text for numerator
AddMathText(document, mathFraction.Numerator, text);
//Adds a math text for denominator
AddMathText(document, mathFraction.Denominator, "L");
}
/// <summary>
/// Adds a math text
/// </summary>
/// <param name="document">Represents a Word document to add math text</param>
/// <param name="officeMath">Represents an office math to add math text</param>
/// <param name="text">Represents the text to set for math item</param>
private IOfficeMathRunElement AddMathText(WordDocument document, IOfficeMath officeMath, string text)
{
//Adds math text
IOfficeMathRunElement officeMathParaItem = officeMath.Functions.Add(MathFunctionType.RunElement) as IOfficeMathRunElement;
officeMathParaItem.Item = new WTextRange(document);
//Set math text value
(officeMathParaItem.Item as WTextRange).Text = text;
return officeMathParaItem;
}
/// <summary>
/// Adds a math Subscript or Superscript equation
/// </summary>
private IOfficeMathScript AddMathScript(IOfficeMath officeMath, MathScriptType mathScriptType)
{
IOfficeMathScript mathScript = officeMath.Functions.Add(MathFunctionType.SubSuperscript) as IOfficeMathScript;
//Sets the script type as Subscript or Superscript
mathScript.ScriptType = mathScriptType;
return mathScript;
}
/// <summary>
/// Adds a accent equation
/// </summary>
/// <param name="document">Represents a Word document</param>
/// <param name="officeMath">Represents a office math to add accent equation</param>
/// <param name="accentCharValue">Represents a accent character</param>
/// <param name="text">Represents a text for accent equation</param>
private void AddMathAccent(WordDocument document, IOfficeMath officeMath, short accentCharValue, string text)
{
IOfficeMathAccent mathAccent = officeMath.Functions.Add(MathFunctionType.Accent) as IOfficeMathAccent;
//Sets the accent character from short value
mathAccent.AccentCharacter = ConvertShortToString(accentCharValue);
//Adds a math text
IOfficeMathRunElement officeMathParaItem = AddMathText(document, mathAccent.Equation, text);
}
/// <summary>
/// Add values in matrix row
/// </summary>
/// <param name="document">Represents a Word document to add matrix</param>
/// <param name="mathMatrixRow">Represents a matrix row to add values</param>
/// <param name="text">Represents a base text value for Subscript and Superscript equation</param>
private void AddMatrixRowValues(WordDocument document, IOfficeMathMatrixRow mathMatrixRow, string text)
{
//Adds arguments for matrix row
IOfficeMath officeMath = mathMatrixRow.Arguments[0];
//Adds a Subscript
IOfficeMathScript mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds a math text
IOfficeMathRunElement officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "x");
//Adds arguments for matrix row
officeMath = mathMatrixRow.Arguments[1];
//Adds a script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "y");
//Adds arguments for matrix row
officeMath = mathMatrixRow.Arguments[2];
//Adds a script
mathScript = AddMathScript(officeMath, MathScriptType.Subscript);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Equation, text);
//Adds math text
officeMathParaItem = AddMathText(document, mathScript.Script, "z");
}
#endregion
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.EncryptAndDecryptDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="EncryptAndDecrypt" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates how to encrypt and decrypt the Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<StackPanel Name="securityOptions" Grid.Row="5" Grid.ColumnSpan="4" Orientation="Vertical" VerticalAlignment="Top">
<RadioButton GroupName="Security" Content="Encrypt Document" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdEncrypt" Width="200" IsChecked="True"/>
<RadioButton GroupName="Security" Content="Decrypt Document" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDecrypt" Width="200"/>
</StackPanel>
<TextBlock x:Name="TextBlock6" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<TextBlock x:Name="TextBlock7" Grid.Row="14" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="15" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock8" Grid.Row="16" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,219 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class EncryptAndDecryptDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdEncrypt);
rdEncrypt = null;
DisposeRadioButton(rdDecrypt);
rdDecrypt = null;
securityOptions.ClearValue(StackPanel.OrientationProperty);
securityOptions.ClearValue(StackPanel.VerticalAlignmentProperty);
securityOptions = null;
EncryptAndDecrypt.ClearValue(Grid.BackgroundProperty);
EncryptAndDecrypt.ClearValue(Grid.PaddingProperty);
EncryptAndDecrypt.Children.Clear();
EncryptAndDecrypt.ColumnDefinitions.Clear();
EncryptAndDecrypt.RowDefinitions.Clear();
EncryptAndDecrypt = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
public EncryptAndDecryptDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
EncryptAndDecrypt.Margin = new Thickness(10, 10, 10, 10);
securityOptions.Visibility = Visibility.Collapsed;
TextBlock5.Visibility = Visibility.Collapsed;
TextBlock6.Visibility = Visibility.Collapsed;
TextBlock7.Visibility = Visibility.Collapsed;
TextBlock4.Visibility = Visibility.Collapsed;
}
else
{
securityOptions.Visibility = Visibility.Visible;
TextBlock6.Visibility = Visibility.Visible;
TextBlock5.Visibility = Visibility.Visible;
TextBlock7.Visibility = Visibility.Visible;
}
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
Assembly execAssem = typeof(EncryptAndDecryptDemo).GetTypeInfo().Assembly;
WordDocument document = null;
if (rdEncrypt.IsChecked==true)
{
document = new WordDocument();
document.EnsureMinimal();
// Getting last section of the document.
IWSection section = document.LastSection;
// Adding a paragraph to the section.
IWParagraph paragraph = section.AddParagraph();
// Writing text
IWTextRange text = paragraph.AppendText("This document was encrypted with password");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
// Encrypt the document by giving password
document.EncryptDocument("syncfusion");
}
else
{
// Open an existing template document with single section.
document = new WordDocument();
Stream inputStream = execAssem.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Security Settings.docx");
// Open an existing template document.
await document.OpenAsync(inputStream, FormatType.Docx, "syncfusion");
inputStream.Dispose();
// Getting last section of the document.
IWSection section = document.LastSection;
// Adding a paragraph to the section.
IWParagraph paragraph = section.AddParagraph();
// Writing text
IWTextRange text = paragraph.AppendText("\nDemo For Document Decryption with Essential DocIO");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
text = paragraph.AppendText("\nThis document is Decrypted");
text.CharacterFormat.FontSize = 16f;
text.CharacterFormat.FontName = "Bitstream Vera Serif";
}
Save(document);
}
private async void Save(WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// File types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Encrypt and Decrypt";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
//Save as Docx Format
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.FindAndReplaceDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="FindAndReplace" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates the find and replace functionality in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" TextWrapping="Wrap" Text="Look in :" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBox x:Name="InputFile1" Grid.Row="3" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Button x:Name="Button1" Grid.Row="3" Grid.Column="2" Content=". . ." Click="Button_Click_3" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="15,7,15,5"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="5" TextWrapping="Wrap" Text="Find what :" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBox x:Name="FindTextBox" Grid.Row="5" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock7" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock8" Grid.Row="7" FontFamily="Segoe UI" FontSize="16" TextWrapping="Wrap" Text="Replace with :" Foreground="#333333"/>
<TextBox x:Name="ReplaceTextBox" Grid.Row="7" Grid.Column="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock9" Grid.Row="8" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock10" Grid.Row="9" TextWrapping="Wrap" Text="Search Options : " FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<CheckBox x:Name="chkBoxMatchCase" Grid.Row="9" Grid.Column="1" Content="Match Case" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<CheckBox x:Name="chkBoxWholeWord" Grid.Row="9" Grid.Column="2" Content="Whole Word" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock11" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock12" Grid.Row="11" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock13" Grid.Row="12" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock14" Grid.Row="13" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock15" Grid.Row="14" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="15" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock16" Grid.Row="16" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock17" Grid.Row="17" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button Grid.Row="18" Grid.ColumnSpan="4" x:Name="generateButton" IsEnabled="False" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock18" Grid.Row="19" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,237 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class FindAndReplaceDemo : SampleLayout
{
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
DisposeTextBlock(TextBlock11);
TextBlock11 = null;
DisposeTextBlock(TextBlock12);
TextBlock12 = null;
DisposeTextBlock(TextBlock13);
TextBlock13 = null;
DisposeTextBlock(TextBlock14);
TextBlock14 = null;
DisposeTextBlock(TextBlock15);
TextBlock15 = null;
DisposeTextBlock(TextBlock16);
TextBlock16 = null;
DisposeTextBlock(TextBlock17);
TextBlock17 = null;
DisposeTextBlock(TextBlock18);
TextBlock18 = null;
DisposeTextBox(InputFile1);
InputFile1 = null;
DisposeTextBox(FindTextBox);
FindTextBox = null;
DisposeTextBox(ReplaceTextBox);
ReplaceTextBox = null;
DisposeCheckBox(chkBoxMatchCase);
chkBoxMatchCase = null;
DisposeCheckBox(chkBoxWholeWord);
chkBoxWholeWord = null;
Button1.Click -= Button_Click_3;
DisposeButton(Button1);
Button1 = null;
generateButton.Click -= Button_Click_1;
DisposeButton(generateButton);
generateButton = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
FindAndReplace.ClearValue(Grid.BackgroundProperty);
FindAndReplace.ClearValue(Grid.PaddingProperty);
FindAndReplace.Children.Clear();
FindAndReplace.ColumnDefinitions.Clear();
FindAndReplace.RowDefinitions.Clear();
FindAndReplace = null;
}
public void DisposeCheckBox(CheckBox checkBox)
{
checkBox.ClearValue(CheckBox.FontFamilyProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
}
public void DisposeTextBox(TextBox textBox)
{
textBox.ClearValue(TextBox.FontFamilyProperty);
textBox.ClearValue(TextBox.FontSizeProperty);
textBox.ClearValue(TextBox.ForegroundProperty);
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
button.ClearValue(Button.IsEnabledProperty);
}
public FindAndReplaceDemo()
{
InitializeComponent();
}
StorageFile file;
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
WordDocument document = new WordDocument();
//Open an existing word document.
await document.OpenAsync(file);
if (FindTextBox.Text.Trim() == string.Empty || ReplaceTextBox.Text.Trim() == string.Empty)
{
MessageDialog msgDialog = new MessageDialog("Please fill the find and replacement text in appropriate textboxes...");
UICommand okCmd = new UICommand("Ok");
msgDialog.Commands.Add(okCmd);
IUICommand cmd = await msgDialog.ShowAsync();
}
else
{
document.Replace(FindTextBox.Text, ReplaceTextBox.Text, chkBoxMatchCase.IsChecked.Value, chkBoxWholeWord.IsChecked.Value);
StorageFile stgFile = null;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.SuggestedFileName = "Sample";
if (rdDoc.IsChecked.Value)
{
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
stgFile = await savePicker.PickSaveFileAsync();
if (stgFile != null)
await document.SaveAsync(stgFile, FormatType.Doc);
}
else
{
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
stgFile = await savePicker.PickSaveFileAsync();
if (stgFile != null)
{
await document.SaveAsync(stgFile, FormatType.Docx);
}
}
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
if (stgFile != null)
{
await document.SaveAsync(stgFile, FormatType.Docx);
}
}
if (stgFile != null)
{
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
private async void Button_Click_3(object sender, RoutedEventArgs e)
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add(".doc");
openPicker.FileTypeFilter.Add(".docx");
StorageFile tempFile = await openPicker.PickSingleFileAsync();
if (tempFile != null)
file = tempFile;
if (file == null)
generateButton.IsEnabled = false;
else
{
// Application now has read/write access to the picked file
InputFile1.Text = file.Name;
generateButton.IsEnabled = true;
}
}
}
}

Просмотреть файл

@ -1,43 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.FormFillingAndProtectionDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="FormFillingAndProtection" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample illustrates filling form and protecting the content controls in an existing Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Click the button to view the generated Word document. Please note that Microsoft Word Viewer or Microsoft Word is required to view the resultant Word document." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock5" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock6" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<Button x:Name="Button1" Grid.Row="10" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock7" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,318 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using System.Reflection;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class FormFillingAndProtectionDemo : SampleLayout
{
#region Fields
// Gets current executing assembly.
Assembly execAssm = typeof(FormFillingAndProtectionDemo).GetTypeInfo().Assembly;
#endregion
/// <summary>
/// Constructor for FormFillingAndProtectionDemo.
/// </summary>
public FormFillingAndProtectionDemo()
{
InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
TextBlock4.Visibility = Visibility.Collapsed;
}
}
/// <summary>
/// Disposes the objects such as text blocks, buttons, and etc., of FormFillingAndProtection.
/// </summary>
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
FormFillingAndProtection.ClearValue(Grid.BackgroundProperty);
FormFillingAndProtection.ClearValue(Grid.PaddingProperty);
FormFillingAndProtection.Children.Clear();
FormFillingAndProtection.ColumnDefinitions.Clear();
FormFillingAndProtection.RowDefinitions.Clear();
FormFillingAndProtection = null;
}
/// <summary>
/// Disposes the objects from text block.
/// </summary>
/// <param name="textBlock">Text Block</param>
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
/// <summary>
/// Disposes the object from button.
/// </summary>
/// <param name="button">Button</param>
public void DisposeButton(Button button)
{
button.ClearValue(FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
}
/// <summary>
/// Button click event for FormFillingAndProtection.
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">Event args</param>
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Load Template document stream.
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.ContentControlTemplate.docx");
// Creates an empty Word document instance.
WordDocument document = new WordDocument();
// Opens template document.
document.Open(inputStream, FormatType.Docx);
IWTextRange textRange;
//Gets table from the template document.
IWTable table = document.LastSection.Tables[0];
WTableRow row = table.Rows[1];
#region Inserting content controls
#region Calendar content control
IWParagraph cellPara = row.Cells[0].Paragraphs[0];
//Accesses the date picker content control.
IInlineContentControl inlineControl = (cellPara.ChildEntities[2] as IInlineContentControl);
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets today's date to display.
textRange.Text = DateTime.Now.ToString("d");
textRange.CharacterFormat.FontSize = 14;
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
#endregion
#region Plain text content controls
table = document.LastSection.Tables[1];
row = table.Rows[0];
cellPara = row.Cells[0].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets text in plain text content control.
textRange.Text = "Northwind Analytics";
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
textRange = inlineControl.ParagraphItems[0] as WTextRange;
//Sets text in plain text content control.
textRange.Text = "Northwind";
textRange.CharacterFormat.FontSize = 14;
row = table.Rows[1];
cellPara = row.Cells[0].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
//Sets text in plain text content control.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "10";
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Accesses the plain text content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
//Protects the content control.
inlineControl.ContentControlProperties.LockContents = true;
//Sets text in plain text content control.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "Nancy Davolio";
textRange.CharacterFormat.FontSize = 14;
#endregion
#region CheckBox Content control
row = table.Rows[2];
cellPara = row.Cells[0].LastParagraph;
//Inserts checkbox content control.
inlineControl = cellPara.AppendInlineContentControl(ContentControlType.CheckBox);
inlineControl.ContentControlProperties.LockContents = true;
//Sets checkbox as checked state.
inlineControl.ContentControlProperties.IsChecked = true;
textRange = cellPara.AppendText("C#, ");
textRange.CharacterFormat.FontSize = 14;
//Inserts checkbox content control.
inlineControl = cellPara.AppendInlineContentControl(ContentControlType.CheckBox);
inlineControl.ContentControlProperties.LockContents = true;
//Sets checkbox as checked state.
inlineControl.ContentControlProperties.IsChecked = true;
textRange = cellPara.AppendText("VB");
textRange.CharacterFormat.FontSize = 14;
#endregion
#region Drop down list content control
cellPara = row.Cells[1].LastParagraph;
//Accesses the dropdown list content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default option to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = "ASP.NET";
textRange.CharacterFormat.FontSize = 14;
inlineControl.ParagraphItems.Add(textRange);
//Adds items to the dropdown list.
ContentControlListItem item;
item = new ContentControlListItem();
item.DisplayText = "ASP.NET MVC";
item.Value = "2";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "Windows Forms";
item.Value = "3";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "WPF";
item.Value = "4";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
item = new ContentControlListItem();
item.DisplayText = "Xamarin";
item.Value = "5";
inlineControl.ContentControlProperties.ContentControlListItems.Add(item);
#endregion
#region Calendar content control
row = table.Rows[3];
cellPara = row.Cells[0].LastParagraph;
//Accesses the date picker content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default date to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = DateTime.Now.AddDays(-5).ToString("d");
textRange.CharacterFormat.FontSize = 14;
cellPara = row.Cells[1].LastParagraph;
//Inserts date picker content control.
inlineControl = (cellPara.ChildEntities[1] as IInlineContentControl);
inlineControl.ContentControlProperties.LockContents = true;
//Sets default date to display.
textRange = inlineControl.ParagraphItems[0] as WTextRange;
textRange.Text = DateTime.Now.AddDays(10).ToString("d");
textRange.CharacterFormat.FontSize = 14;
#endregion
#endregion
#region Block content control
//Accesses the block content control.
BlockContentControl blockContentControl = ((document.ChildEntities[0] as WSection).Body.ChildEntities[2] as BlockContentControl);
//Protects the block content control
blockContentControl.ContentControlProperties.LockContents = true;
#endregion
Save(document);
}
/// <summary>
/// Saves Word document.
/// </summary>
/// <param name="document">Word document</param>
private async void Save(WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,53 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.GettingStartedDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="GettingStarted" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText1" Grid.Row="1" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="This sample demonstrates to create Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock2" Grid.Row="2" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="WinRTText2" Grid.Row="3" Grid.ColumnSpan="4" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="text1" Grid.Row="4" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock Grid.Row="5" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" x:Name="saveas" Foreground="#333333"/>
<TextBlock x:Name="text2" Grid.Row="6" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="9" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock4" Grid.Row="10" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock5" Grid.Row="11" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="12" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Height="Auto" Width="Auto" Padding="30,10,30,10" />
<TextBlock x:Name="TextBlock6" Grid.Row="13" Grid.ColumnSpan="4" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,413 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using System.Reflection;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GettingStartedDemo : SampleLayout
{
#region Fields
Assembly execAssm = typeof(GettingStartedDemo).GetTypeInfo().Assembly;
#endregion
public GettingStartedDemo()
{
this.InitializeComponent();
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
GettingStarted.Margin = new Thickness(10, 10, 10, 10);
stackPnlOptions.Visibility = Visibility.Collapsed;
saveas.Visibility = Visibility.Collapsed;
text1.Visibility = Visibility.Collapsed;
text2.Visibility = Visibility.Collapsed;
WinRTText2.Visibility = Visibility.Collapsed;
}
else
{
stackPnlOptions.Visibility = Visibility.Visible;
saveas.Visibility = Visibility.Visible;
text1.Visibility = Visibility.Visible;
text2.Visibility = Visibility.Visible;
}
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(saveas);
saveas = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(WinRTText1);
WinRTText1 = null;
DisposeTextBlock(WinRTText2);
WinRTText2 = null;
DisposeTextBlock(text1);
text1 = null;
DisposeTextBlock(text2);
text2 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
GettingStarted.ClearValue(Grid.BackgroundProperty);
GettingStarted.ClearValue(Grid.PaddingProperty);
GettingStarted.Children.Clear();
GettingStarted.ColumnDefinitions.Clear();
GettingStarted.RowDefinitions.Clear();
GettingStarted = null;
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Creating a new document.
WordDocument document = new WordDocument();
//Adding a new section to the document.
WSection section = document.AddSection() as WSection;
//Set Margin of the section
section.PageSetup.Margins.All = 72;
//Set page size of the section
section.PageSetup.PageSize.Width = 612;
section.PageSetup.PageSize.Height = 792;
//Create Paragraph styles
WParagraphStyle style = document.AddParagraphStyle("Normal") as WParagraphStyle;
style.CharacterFormat.FontName = "Calibri";
style.CharacterFormat.FontSize = 11f;
style.ParagraphFormat.BeforeSpacing = 0;
style.ParagraphFormat.AfterSpacing = 8;
style.ParagraphFormat.LineSpacing = 13.8f;
style = document.AddParagraphStyle("Heading 1") as WParagraphStyle;
style.ApplyBaseStyle("Normal");
style.CharacterFormat.FontName = "Calibri Light";
style.CharacterFormat.FontSize = 16f;
style.CharacterFormat.TextColor = Color.FromArgb(46, 116, 181);
style.ParagraphFormat.BeforeSpacing = 12;
style.ParagraphFormat.AfterSpacing = 0;
style.ParagraphFormat.Keep = true;
style.ParagraphFormat.KeepFollow = true;
style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
IWParagraph paragraph = section.HeadersFooters.Header.AddParagraph();
Stream imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.AdventureCycle.jpg");
//Appends picture to the paragraph.
WPicture picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
picture.VerticalOrigin = VerticalOrigin.Margin;
picture.VerticalPosition = -45;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = 263.5f;
picture.WidthScale = 20;
picture.HeightScale = 15;
paragraph.ApplyStyle("Normal");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Left;
WTextRange textRange = paragraph.AppendText("Adventure Works Cycles") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends paragraph.
paragraph = section.AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
textRange = paragraph.AppendText("Adventure Works Cycles") as WTextRange;
textRange.CharacterFormat.FontSize = 18f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends paragraph.
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.FirstLineIndent = 36;
paragraph.BreakCharacterFormat.FontSize = 12f;
textRange = paragraph.AppendText("Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base.") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.FirstLineIndent = 36;
paragraph.BreakCharacterFormat.FontSize = 12f;
textRange = paragraph.AppendText("In 2000, Adventure Works Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the Adventure Works Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
paragraph = section.AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Left;
textRange = paragraph.AppendText("Product Overview") as WTextRange;
textRange.CharacterFormat.FontSize = 16f;
textRange.CharacterFormat.FontName = "Calibri";
//Appends table.
IWTable table = section.AddTable();
table.ResetCells(3, 2);
table.TableFormat.Borders.BorderType = BorderStyle.None;
table.TableFormat.IsAutoResized = true;
//Appends paragraph.
paragraph = table[0, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Mountain-200.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 4.5f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -2.15f;
picture.WidthScale = 79;
picture.HeightScale = 79;
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Mountain-200");
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-M68B-38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 25\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $2,294.99\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[0, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Mountain-300 ");
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-M47B-38\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 35\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 22\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $1,079.99\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[1, 0].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
//Appends paragraph.
paragraph = table[1, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Mountain-300.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 8.2f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -14.95f;
picture.WidthScale = 75;
picture.HeightScale = 75;
//Appends paragraph.
paragraph = table[2, 0].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends picture to the paragraph.
imageStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Road-550-W.jpg");
//Appends picture to the paragraph.
picture = paragraph.AppendPicture(imageStream) as WPicture;
picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom;
picture.VerticalOrigin = VerticalOrigin.Paragraph;
picture.VerticalPosition = 3.75f;
picture.HorizontalOrigin = HorizontalOrigin.Column;
picture.HorizontalPosition = -5f;
picture.WidthScale = 92;
picture.HeightScale = 92;
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.AppendText("Road-150 ");
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ParagraphFormat.AfterSpacing = 0;
paragraph.ParagraphFormat.LineSpacing = 12f;
paragraph.BreakCharacterFormat.FontSize = 12f;
paragraph.BreakCharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Product No: BK-R93R-44\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Size: 44\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Weight: 14\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
textRange = paragraph.AppendText("Price: $3,578.27\r") as WTextRange;
textRange.CharacterFormat.FontSize = 12f;
textRange.CharacterFormat.FontName = "Times New Roman";
//Appends paragraph.
paragraph = table[2, 1].AddParagraph();
paragraph.ApplyStyle("Heading 1");
paragraph.ParagraphFormat.LineSpacing = 12f;
//Appends paragraph.
section.AddParagraph();
Save(rdDoc.IsChecked == true, document);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
<View:SampleLayout
x:Class="EssentialDocIO.HeadersAndFootersDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:EssentialDocIO" xmlns:View="using:Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:common="using:Common"
xmlns:Controls ="using:Syncfusion.UI.Xaml.Controls.Input">
<View:SampleLayout.Sample>
<ContentControl>
<Grid x:Name="HeaderFooter" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width=".5*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock1" Grid.Row="0" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock2" Grid.Row="1" Grid.ColumnSpan="6" TextWrapping="Wrap" Text="This sample demonstrates the header and footer in Word document using Essential DocIO." FontFamily="Segoe UI" FontSize="20" Foreground="#333333"/>
<TextBlock x:Name="TextBlock3" Grid.Row="2" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="18"/>
<TextBlock x:Name="TextBlock4" Grid.Row="3" Grid.ColumnSpan="2" TextWrapping="Wrap" Text="Header and Footer" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Rectangle Grid.Row="3" Grid.RowSpan="5" Grid.Column="2" Width="1" StrokeThickness="0.75" Stroke="#666666"></Rectangle>
<TextBlock x:Name="TextBlock5" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="2" TextWrapping="Wrap" Text="Page Number" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock6" Grid.Row="4" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<CheckBox x:Name="checkBox1" Grid.Row="5" Grid.ColumnSpan="6" Content="Header and Footer for First page" IsChecked="True" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" Width="256"/>
<TextBlock Grid.Row="5" Grid.Column="3" TextWrapping="Wrap" Text="Number Format" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<ComboBox x:Name="comboBox1" Grid.Row="5" Grid.Column="4" Grid.ColumnSpan="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock Grid.Row="6" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<CheckBox x:Name="checkBox2" Grid.Row="7" Grid.ColumnSpan="6" Content="Header and Footer for All pages" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" Width="252"/>
<TextBlock x:Name="TextBlock7" Grid.Row="7" Grid.Column="3" TextWrapping="Wrap" Text="Start At" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<Controls:SfNumericUpDown FormatString="##" x:Name="numericUpDown1" Grid.Row="7" Grid.Column="4" Grid.ColumnSpan="1" Minimum="1" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" AccentBrush="#FF656868"/>
<TextBlock x:Name="TextBlock8" Grid.Row="8" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock9" Grid.Row="9" Grid.ColumnSpan="6" TextWrapping="Wrap" Text="Please click the Generate button to save and view the Word document generated by Essential DocIO." FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock10" Grid.Row="10" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock11" Grid.Row="11" TextWrapping="Wrap" Text="Save As" FontFamily="Segoe UI" FontSize="16" Foreground="#333333"/>
<TextBlock x:Name="TextBlock12" Grid.Row="12" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="14"/>
<StackPanel Name="stackPnlOptions" Grid.Row="13" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Left">
<RadioButton GroupName="Save As" Content="DOC" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDoc" Width="150" />
<RadioButton GroupName="Save As" Content="DOCX" FontFamily="Segoe UI" FontSize="16" Foreground="#333333" x:Name="rdDocx" Width="150" IsChecked="True"/>
</StackPanel>
<TextBlock x:Name="TextBlock13" Grid.Row="14" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<TextBlock x:Name="TextBlock14" Grid.Row="15" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
<Button x:Name="Button1" Grid.Row="16" Grid.ColumnSpan="4" Content="Generate" Click="Button_Click_1" FontFamily="Segoe UI" FontSize="16" Foreground="#FFFFFF" Background="#656868" Padding="30,10,30,10"/>
<TextBlock x:Name="TextBlock15" Grid.Row="17" Grid.ColumnSpan="6" FontFamily="Segoe UI" FontSize="16"/>
</Grid>
</ContentControl>
</View:SampleLayout.Sample>
</View:SampleLayout>

Просмотреть файл

@ -1,356 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Common;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace EssentialDocIO
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class HeadersAndFootersDemo : SampleLayout
{
public HeadersAndFootersDemo()
{
InitializeComponent();
//Associate PageNumberStyle Enum values to comboBox
foreach (String str in Enum.GetNames(typeof(PageNumberStyle)))
comboBox1.Items.Add(str);
comboBox1.SelectedIndex = 2;
}
public override void Dispose()
{
base.Dispose();
DisposeTextBlock(TextBlock1);
TextBlock1 = null;
DisposeTextBlock(TextBlock2);
TextBlock2 = null;
DisposeTextBlock(TextBlock3);
TextBlock3 = null;
DisposeTextBlock(TextBlock4);
TextBlock4 = null;
DisposeTextBlock(TextBlock5);
TextBlock5 = null;
DisposeTextBlock(TextBlock6);
TextBlock6 = null;
DisposeTextBlock(TextBlock7);
TextBlock7 = null;
DisposeTextBlock(TextBlock8);
TextBlock8 = null;
DisposeTextBlock(TextBlock9);
TextBlock9 = null;
DisposeTextBlock(TextBlock10);
TextBlock10 = null;
DisposeTextBlock(TextBlock11);
TextBlock11 = null;
DisposeTextBlock(TextBlock12);
TextBlock12 = null;
DisposeTextBlock(TextBlock13);
TextBlock13 = null;
DisposeTextBlock(TextBlock14);
TextBlock14 = null;
DisposeTextBlock(TextBlock15);
TextBlock15 = null;
Button1.Click -= Button_Click_1;
DisposeButton(Button1);
Button1 = null;
DisposeRadioButton(rdDoc);
rdDoc = null;
DisposeRadioButton(rdDocx);
rdDocx = null;
DisposeCheckBox(checkBox1);
checkBox1 = null;
DisposeCheckBox(checkBox2);
checkBox2 = null;
comboBox1.ClearValue(ComboBox.FontFamilyProperty);
comboBox1.ClearValue(ComboBox.FontSizeProperty);
comboBox1.ClearValue(ComboBox.ForegroundProperty);
comboBox1 = null;
stackPnlOptions.ClearValue(StackPanel.OrientationProperty);
stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty);
stackPnlOptions = null;
HeaderFooter.ClearValue(Grid.BackgroundProperty);
HeaderFooter.ClearValue(Grid.PaddingProperty);
HeaderFooter.Children.Clear();
HeaderFooter.ColumnDefinitions.Clear();
HeaderFooter.RowDefinitions.Clear();
HeaderFooter = null;
}
public void DisposeCheckBox(CheckBox checkBox)
{
checkBox.ClearValue(CheckBox.FontFamilyProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
checkBox.ClearValue(CheckBox.FontSizeProperty);
}
public void DisposeRadioButton(RadioButton radioButton)
{
radioButton.ClearValue(RadioButton.GroupNameProperty);
radioButton.ClearValue(RadioButton.ContentProperty);
radioButton.ClearValue(RadioButton.FontFamilyProperty);
radioButton.ClearValue(RadioButton.FontSizeProperty);
radioButton.ClearValue(RadioButton.ForegroundProperty);
radioButton.ClearValue(RadioButton.WidthProperty);
radioButton.ClearValue(RadioButton.IsCheckedProperty);
}
public void DisposeTextBlock(TextBlock textBlock)
{
textBlock.ClearValue(TextBlock.FontFamilyProperty);
textBlock.ClearValue(TextBlock.FontSizeProperty);
textBlock.ClearValue(TextBlock.TextProperty);
textBlock.ClearValue(TextBlock.TextWrappingProperty);
textBlock.ClearValue(TextBlock.ForegroundProperty);
}
public void DisposeButton(Button button)
{
button.ClearValue(Button.FontFamilyProperty);
button.ClearValue(Button.FontSizeProperty);
button.ClearValue(Button.PaddingProperty);
button.ClearValue(Button.ForegroundProperty);
button.ClearValue(Button.BackgroundProperty);
button.ClearValue(Button.ContentProperty);
button.ClearValue(Button.HeightProperty);
button.ClearValue(Button.WidthProperty);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Creating a new document.
WordDocument doc = new WordDocument();
// Add a new section to the document.
IWSection section1 = doc.AddSection();
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
#region Header Footer
//Add different Header Footer for first and other pages
if (checkBox1.IsChecked == true && checkBox2.IsChecked == true)
{
// Set the header/footer setup.
section1.PageSetup.DifferentFirstPage = true;
// Inserting Header Footer to first page
InsertFirstPageHeaderFooter(doc, section1);
// Inserting Header Footer to all pages
InsertPageHeaderFooter(doc, section1);
}
//Add Header Footer only for first page
if (checkBox1.IsChecked == true && checkBox2.IsChecked != true)
{
// Set the header/footer setup.
section1.PageSetup.DifferentFirstPage = true;
// Inserting Header Footer to first page
InsertFirstPageHeaderFooter(doc, section1);
}
//Add same Header Footer for all the pages
if (checkBox2.IsChecked == true && checkBox1.IsChecked != true)
{
// Inserting Header Footer to all pages
InsertPageHeaderFooter(doc, section1);
}
#endregion
// Add text to the document body section.
IWParagraph par;
par = section1.AddParagraph();
//Insert Text into the word Document.
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.WinFAQ.txt");
StreamReader reader = new StreamReader(inputStream, System.Text.Encoding.Unicode);
string text = reader.ReadToEnd();
par.AppendText(text);
Save(rdDoc.IsChecked == true, doc);
}
private async void Save(bool isDocFormat, WordDocument document)
{
StorageFile stgFile;
if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
if (isDocFormat)
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".doc" });
else
savePicker.FileTypeChoices.Add("Word Document", new List<string>() { ".docx" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "Sample";
stgFile = await savePicker.PickSaveFileAsync();
}
else
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
stgFile = await local.CreateFileAsync("WordDocument.docx", CreationCollisionOption.ReplaceExisting);
}
if (stgFile != null)
{
MemoryStream stream = new MemoryStream();
if (isDocFormat)
await document.SaveAsync(stream, FormatType.Doc);
else
await document.SaveAsync(stream, FormatType.Docx);
document.Close();
stream.Position = 0;
Windows.Storage.Streams.IRandomAccessStream fileStream = await stgFile.OpenAsync(FileAccessMode.ReadWrite);
Stream st = fileStream.AsStreamForWrite();
st.SetLength(0);
st.Write((stream as MemoryStream).ToArray(), 0, (int)stream.Length);
st.Flush();
st.Dispose();
fileStream.Dispose();
MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File has been created successfully.");
UICommand yesCmd = new UICommand("Yes");
msgDialog.Commands.Add(yesCmd);
UICommand noCmd = new UICommand("No");
msgDialog.Commands.Add(noCmd);
IUICommand cmd = await msgDialog.ShowAsync();
if (cmd == yesCmd)
{
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(stgFile);
}
}
}
#region Helper Methods
#region InsertFirstPageHeaderFooter
private void InsertFirstPageHeaderFooter(WordDocument doc, IWSection section)
{
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind_logo.png");
// Add a new paragraph for header to the document.
IWParagraph headerPar = new WParagraph(doc);
// Add a new table to the header.
IWTable table = section.HeadersFooters.FirstPageHeader.AddTable();
RowFormat format = new RowFormat();
// Setting cleared table border style.
format.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Cleared;
// Inserting table with a row and two columns.
table.ResetCells(1, 2, format, 265);
// Inserting logo image to the table first cell.
headerPar = table[0, 0].AddParagraph() as WParagraph;
headerPar.AppendPicture(inputStream);
//Set Image size
(headerPar.Items[0] as WPicture).Width = 232.5f;
(headerPar.Items[0] as WPicture).Height = 54.75f;
// Inserting text to the table second cell.
headerPar = table[0, 1].AddParagraph() as WParagraph;
IWTextRange txt = headerPar.AppendText("Company Headquarters,\n2501 Aerial Center Parkway,\nSuite 110, Morrisville, NC 27560,\nTEL 1-888-936-8638.");
txt.CharacterFormat.FontSize = 12;
txt.CharacterFormat.CharacterSpacing = 1.7f;
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Right;
// Add a new paragraph to the header with address text.
headerPar = new WParagraph(doc);
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center;
txt = headerPar.AppendText("\nFirst Page Header");
txt.CharacterFormat.CharacterSpacing = 1.7f;
section.HeadersFooters.FirstPageHeader.Paragraphs.Add(headerPar);
// Add a footer paragraph text to the document.
WParagraph footerPar = new WParagraph(doc);
footerPar.ParagraphFormat.Tabs.AddTab(523f, TabJustification.Right, TabLeader.NoLeader);
// Add text.
footerPar.AppendText("Copyright Northwind Inc. 2001 - 2015");
// Add page and Number of pages field to the document.
footerPar.AppendText("\tFirst Page ");
footerPar.AppendField("Page", FieldType.FieldPage);
section.HeadersFooters.FirstPageFooter.Paragraphs.Add(footerPar);
#region Page Number Settings
section.PageSetup.RestartPageNumbering = true;
section.PageSetup.PageStartingNumber = Convert.ToInt32(this.numericUpDown1.Value);
section.PageSetup.PageNumberStyle = (PageNumberStyle)Enum.Parse(typeof(PageNumberStyle), this.comboBox1.SelectedItem.ToString(), true);
#endregion
}
#endregion
#region InsertPageHeaderFooter
private void InsertPageHeaderFooter(WordDocument doc, IWSection section1)
{
Assembly execAssm = typeof(HeadersAndFootersDemo).GetTypeInfo().Assembly;
Stream inputStream = execAssm.GetManifestResourceStream("Syncfusion.SampleBrowser.UWP.DocIO.DocIO.Assets.Northwind_logo.png");
// Add a new paragraph for header to the document.
IWParagraph headerPar = new WParagraph(doc);
// Add a new table to the header
IWTable table = section1.HeadersFooters.Header.AddTable();
RowFormat format = new RowFormat();
// Setting Single table border style.
format.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Single;
// Inserting table with a row and two columns.
table.ResetCells(1, 2, format, 265);
// Inserting logo image to the table first cell.
headerPar = table[0, 0].AddParagraph() as WParagraph;
headerPar.AppendPicture(inputStream);
//Set Image size.
(headerPar.Items[0] as WPicture).Width = 232.5f;
(headerPar.Items[0] as WPicture).Height = 54.75f;
// Inserting text to the table second cell.
headerPar = table[0, 1].AddParagraph() as WParagraph;
IWTextRange txt = headerPar.AppendText("Company Headquarters,\n2501 Aerial Center Parkway,\nSuite 110, Morrisville, NC 27560,\nTEL 1-888-936-8638.");
txt.CharacterFormat.FontSize = 12;
txt.CharacterFormat.CharacterSpacing = 1.7f;
headerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Right;
// Add a footer paragraph text to the document.
WParagraph footerPar = new WParagraph(doc);
footerPar.ParagraphFormat.Tabs.AddTab(523f, TabJustification.Right, TabLeader.NoLeader);
// Add text.
footerPar.AppendText("Copyright Northwind Inc. 2001 - 2015");
// Add page and Number of pages field to the document.
footerPar.AppendText("\tPage ");
IWField ff = footerPar.AppendField("Page", FieldType.FieldPage);
section1.HeadersFooters.Footer.Paragraphs.Add(footerPar);
#region Page Number Settings
section1.PageSetup.RestartPageNumbering = true;
section1.PageSetup.PageStartingNumber = Convert.ToInt32(this.numericUpDown1.Value);
section1.PageSetup.PageNumberStyle = (PageNumberStyle)Enum.Parse(typeof(PageNumberStyle), this.comboBox1.SelectedItem.ToString(), true);
#endregion
}
#endregion
#endregion
}
}

Просмотреть файл

@ -1,131 +0,0 @@
<Page
xmlns:Controls="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="Invoice.Address"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DocIO/Invoice/Common/IOStandardStyles.Xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid x:Name="outerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="0"></Grid>
<Grid x:Name="RootPanel" Grid.Row="1" Background="#FF004051">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="0.25*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="1.5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" x:Name="Title" HorizontalAlignment="Center" VerticalAlignment="Bottom" Text="BILL TO" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" FontSize="32" FontWeight="Light"></TextBlock>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Name" Grid.Column="1" Grid.Row="1" FontSize="18" Padding="0,0,15,5"></TextBlock>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" TextWrapping="Wrap" VerticalAlignment="Bottom" Text="Address" Grid.Column="1" Grid.Row="2" FontSize="18" Padding="0,0,15,5"></TextBlock>
<Grid Grid.Column="3" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Top" Text="DueDate" Grid.Column="3" Grid.Row="3" FontSize="18" Padding="0,0,15,5"></TextBlock>
</Grid>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="Date" Grid.Column="3" Grid.Row="1" FontSize="18" Padding="0,0,15,5"></TextBlock>
<Grid Grid.Column="3" Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Stretch" TextAlignment="Right" VerticalAlignment="Center" Text="Invoice No" FontSize="18" Grid.Row="1" Padding="0,0,15,5"></TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Text="{Binding Mode=TwoWay, Path=Name}" HorizontalAlignment="Left" Width="200" VerticalAlignment="Bottom" Name="nameField" FontFamily="Segoe UI" FontSize="18" Grid.Row="1" Grid.RowSpan="2"></TextBox>
</Grid>
<Grid Grid.Row="2" Grid.Column="2" Grid.RowSpan="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="5*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox FontFamily="Segoe UI" FontSize="18" Text="{Binding Mode=TwoWay, Path=Address}" TextWrapping="Wrap" HorizontalAlignment="Left" Width="200" VerticalAlignment="Stretch" Name="address" Grid.Row="1" Margin="0,0,0,4"/>
</Grid>
<Grid Grid.Row="3" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=DueDate}" Width="200" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Name="dueDate" AccentBrush="#087196" />
</Grid>
<Grid Grid.Row="1" Grid.Column="4">
<Grid Grid.Row="3" Grid.Column="4">
<Controls:SfDatePicker Value="{Binding Mode=TwoWay, Path=Date}" Width="200" HorizontalAlignment="Left" VerticalAlignment="Bottom" Name="Date" AccentBrush="#087196" />
</Grid>
</Grid>
<Grid Grid.Row="2" Grid.Column="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Text="{Binding Mode=TwoWay, Path=InvoiceNumber}" HorizontalAlignment="Left" Width="200" VerticalAlignment="Center" Name="invoiceNo" Grid.Row="1" TextChanged="invoiceNo_TextChanged" Grid.ColumnSpan="2" Margin="0,13"></TextBox>
</Grid>
<Grid Grid.Row="4" Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Top" Name="updtButton" Content="Update" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Click="updtButton_Click"></Button>
<Button Foreground="White" HorizontalAlignment="Stretch" FontFamily="Segoe UI" FontSize="18" VerticalAlignment="Top" Name="cancelButton" Content="Cancel" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Click="cancelButton_Click"></Button>
</Grid>
<Grid Grid.Row="4" Grid.Column="3">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
<Grid Background="#FF004051" Opacity="0.7" Grid.Row="2"></Grid>
</Grid>
</Page>

Просмотреть файл

@ -1,176 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Invoice
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Address : Page,IDisposable
{
public event EventHandler CloseRequested;
public event EventHandler UpdateRequested;
BillingInformation info;
/// <summary>
///
/// </summary>
public Address():this(new BillingInformation())
{
}
/// <summary>
///
/// </summary>
/// <param name="billInfo"></param>
public Address(BillingInformation billInfo)
{
this.InitializeComponent();
var bounds = Window.Current.Bounds;
this.Height = bounds.Height;
info = billInfo;
this.DataContext = info;
}
///// <summary>
///// Invoked when this page is about to be displayed in a Frame.
///// </summary>
///// <param name="e">Event data that describes how this page was reached. The Parameter
///// property is typically used to configure the page.</param>
//protected override void OnNavigatedTo(NavigationEventArgs e)
//{
//}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, RoutedEventArgs e)
{
if (CloseRequested != null)
CloseRequested(this, EventArgs.Empty);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void updtButton_Click(object sender, RoutedEventArgs e)
{
BillingInfoEventArgs args = new BillingInfoEventArgs();
args.BillingInformation = info;
if (UpdateRequested != null)
UpdateRequested(this, args);
}
private void invoiceNo_TextChanged(object sender, TextChangedEventArgs e)
{
int value = 0;
if (int.TryParse(invoiceNo.Text, out value))
{
invoiceNo.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 64, 81));
}
else
{
invoiceNo.BorderBrush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 255, 37, 37));
}
}
#region Implementation
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
public void Dispose()
{
UnlinkChildrens(this);
this.Resources.Clear();
Loaded -= cancelButton_Click;
Loaded -= updtButton_Click;
info = null;
}
/// <summary>
/// Unlinks the child elements from page.
/// </summary>
/// <param name="element"></param>
void UnlinkChildrens(UIElement element)
{
if (element == null)
return;
if (element is Panel)
{
for (int i = 0; i < (element as Panel).Children.Count; i++)
{
UIElement childElement = (element as Panel).Children[i];
UnlinkChildrens(childElement);
(element as Panel).Children.Remove(childElement);
i--;
}
}
else if (element is ItemsControl)
{
for (int j = 0; j < (element as ItemsControl).Items.Count; j++)
{
UIElement childElement = ((element as ItemsControl).Items[j] as UIElement);
if (childElement == null)
{
//(element as ItemsControl).Items.RemoveAt(j);
//j--;
}
else
{
UnlinkChildrens(childElement);
(element as ItemsControl).Items.Remove(childElement);
j--;
}
}
}
else if (element is ContentControl)
{
UnlinkChildrens((element as ContentControl).Content as UIElement);
(element as ContentControl).Content = null;
}
else if (element is UserControl)
{
UnlinkChildrens((element as UserControl).Content as UIElement);
(element as UserControl).Content = null;
}
}
#endregion
}
/// <summary>
///
/// </summary>
public class BillingInfoEventArgs : EventArgs,IDisposable
{
BillingInformation m_billInfo;
public BillingInformation BillingInformation
{
get { return m_billInfo; }
set { m_billInfo = value; }
}
public void Dispose()
{
m_billInfo = null;
}
}
}

Просмотреть файл

@ -1,20 +0,0 @@
<Application
x:Class="Invoice.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Invoice">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Просмотреть файл

@ -1,105 +0,0 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
namespace Invoice
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
if (args.Arguments != "")
{
MainPage mainPage = rootFrame.Content as MainPage;
// Frame f=Window.Current.Content as Page;
mainPage.LaunchedFromToast(args.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичные данные
DocIO/DocIO/Invoice/Assets/About.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Add.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Delete.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Edit.jpg

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.0 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Edit.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 391 B

Двоичные данные
DocIO/DocIO/Invoice/Assets/Excel.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/Export.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
DocIO/DocIO/Invoice/Assets/InvoiceTemplate.xlsx

Двоичный файл не отображается.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше