LEADTOOLS Barcode (Leadtools.Barcode assembly)

Save(String) Method

Show in webframe
Example 







Name of the XML file to create
Saves this BarcodeWriteOptions to an XML file.
Syntax
public void Save( 
   string fileName
)
'Declaration
 
Public Overloads Sub Save( _
   ByVal fileName As String _
) 
'Usage
 
Dim instance As BarcodeWriteOptions
Dim fileName As String
 
instance.Save(fileName)
public void Save( 
   string fileName
)

            

            
 function Leadtools.Barcode.BarcodeWriteOptions.Save(String)( 
   fileName 
)
public:
void Save( 
   String^ fileName
) 

Parameters

fileName
Name of the XML file to create
Remarks

The load/save methods are provided as helper methods for the user. The BarcodeEngine, BarcodeWriter and BarcodeWriter do not use these methods internally.

To load the data previously saved into an XML file, use BarcodeWriteOptions.Load(string fileName).

To save and load data to an XML stream, use BarcodeWriteOptions.Save(Stream stream) and BarcodeWriteOptions.Load(Stream stream).

To save the default write options used by BarcodeWriter, use BarcodeWriter.SaveOptions

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms
Imports Leadtools.Barcode
Imports Leadtools.ImageProcessing

Public Sub BarcodeWriteOptions_LoadSaveExample()
   Dim xmlFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "MyOptions.xml")

   ' Create the options
   Dim options1 As New OneDBarcodeWriteOptions()
   ' Show its values
   ShowOptions("Default 1", options1)

   ' Change some of the values
   options1.UseXModule = True
   options1.EnableErrorCheck = True
   options1.TextPosition = BarcodeOutputTextPosition.None
   ShowOptions("New Options 1", options1)

   ' Save it to disk
   options1.Save(xmlFileName)

   ' Create new options
   Dim options2 As New OneDBarcodeWriteOptions()
   ' Show its values
   ShowOptions("Default 2", options2)

   ' Load the previously saved options
   options2.Load(xmlFileName)
   ' Show its values, should be the same as "New Options 1"
   ShowOptions("Loaded 2", options2)
End Sub

Private Shared Sub ShowOptions(ByVal message As String, ByVal options As OneDBarcodeWriteOptions)
   ' We will only show some of the options in this example
   Console.WriteLine(message)
   Console.WriteLine("  UseXModule: {0}", options.UseXModule)
   Console.WriteLine("  EnableErrorCheck: {0}", options.EnableErrorCheck)
   Console.WriteLine("  TextPosition: {0}", options.TextPosition)
   Console.WriteLine("----------------")
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;

public void BarcodeWriteOptions_LoadSaveExample()
{
   string xmlFileName = Path.Combine(LEAD_VARS.ImagesDir, "MyOptions.xml");

   // Create the options
   OneDBarcodeWriteOptions options1 = new OneDBarcodeWriteOptions();
   // Show its values
   ShowOptions("Default 1", options1);

   // Change some of the values
   options1.UseXModule = true;
   options1.EnableErrorCheck = true;
   options1.TextPosition = BarcodeOutputTextPosition.None;
   ShowOptions("New Options 1", options1);

   // Save it to disk
   options1.Save(xmlFileName);

   // Create new options
   OneDBarcodeWriteOptions options2 = new OneDBarcodeWriteOptions();
   // Show its values
   ShowOptions("Default 2", options2);

   // Load the previously saved options
   options2.Load(xmlFileName);
   // Show its values, should be the same as "New Options 1"
   ShowOptions("Loaded 2", options2);
}

private static void ShowOptions(string message, OneDBarcodeWriteOptions options)
{
   // We will only show some of the options in this example
   Console.WriteLine(message);
   Console.WriteLine("  UseXModule: {0}", options.UseXModule);
   Console.WriteLine("  EnableErrorCheck: {0}", options.EnableErrorCheck);
   Console.WriteLine("  TextPosition: {0}", options.TextPosition);
   Console.WriteLine("----------------");
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;

//
//public void BarcodeWriteOptions_LoadSaveExample()
//{
//   string xmlFileName = @"MyOptions.xml";
//   // Create the options
//   OneDBarcodeWriteOptions options1 = new OneDBarcodeWriteOptions();
//   // Show its values
//   ShowOptions("Default 1", options1);

//   // Change some of the values
//   options1.UseXModule = true;
//   options1.EnableErrorCheck = true;
//   options1.TextPosition = BarcodeOutputTextPosition.None;
//   ShowOptions("New Options 1", options1);

//   // Save it to disk
//   options1.Save(xmlFileName);

//   // Create new options
//   OneDBarcodeWriteOptions options2 = new OneDBarcodeWriteOptions();
//   // Show its values
//   ShowOptions("Default 2", options2);

//   // Load the previously saved options
//   options2.Load(xmlFileName);
//   // Show its values, should be the same as "New Options 1"
//   ShowOptions("Loaded 2", options2);
//}

//private static void ShowOptions(string message, OneDBarcodeWriteOptions options)
//{
//   // We will only show some of the options in this example
//   Debug.WriteLine(message);
//   Debug.WriteLine("  UseXModule: {0}", options.UseXModule);
//   Debug.WriteLine("  EnableErrorCheck: {0}", options.EnableErrorCheck);
//   Debug.WriteLine("  TextPosition: {0}", options.TextPosition);
//   Debug.WriteLine("----------------");
//}
Requirements

Target Platforms

See Also

Reference

BarcodeWriteOptions Class
BarcodeWriteOptions Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Barcode requires a Barcode Module license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features