com.hfg.xml.msofficexml.xlsx.spreadsheetml.SsmlPageMargins Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.xml.msofficexml.xlsx.spreadsheetml;
import com.hfg.graphics.units.GfxSize;
import com.hfg.graphics.units.GfxUnits;
import com.hfg.graphics.units.Inches;
import com.hfg.util.StringUtil;
import com.hfg.xml.msofficexml.xlsx.Xlsx;
//------------------------------------------------------------------------------
/**
Represents an Office Open XML worksheet's page margins (<ssml:pageMargins>) tag.
@author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
// Ex:
public class SsmlPageMargins extends SsmlXMLTag
{
//---------------------------------------------------------------------------
public SsmlPageMargins(Xlsx inXlsx)
{
super(SsmlXML.PAGE_MARGINS, inXlsx);
init();
}
//---------------------------------------------------------------------------
private void init()
{
setLeft(new Inches(0.75f));
setRight(new Inches(0.75f));
setTop(new Inches(1f));
setBottom(new Inches(1f));
setHeader(new Inches(0.5f));
setFooter(new Inches(0.5f));
}
//---------------------------------------------------------------------------
public SsmlPageMargins setLeft(GfxSize inValue)
{
setAttribute(SsmlXML.LEFT_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getLeft()
{
String stringValue = getAttributeValue(SsmlXML.LEFT_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
//---------------------------------------------------------------------------
public SsmlPageMargins setRight(GfxSize inValue)
{
setAttribute(SsmlXML.RIGHT_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getRight()
{
String stringValue = getAttributeValue(SsmlXML.RIGHT_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
//---------------------------------------------------------------------------
public SsmlPageMargins setTop(GfxSize inValue)
{
setAttribute(SsmlXML.TOP_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getTop()
{
String stringValue = getAttributeValue(SsmlXML.TOP_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
//---------------------------------------------------------------------------
public SsmlPageMargins setBottom(GfxSize inValue)
{
setAttribute(SsmlXML.BOTTOM_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getBottom()
{
String stringValue = getAttributeValue(SsmlXML.BOTTOM_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
//---------------------------------------------------------------------------
public SsmlPageMargins setHeader(GfxSize inValue)
{
setAttribute(SsmlXML.HEADER_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getHeader()
{
String stringValue = getAttributeValue(SsmlXML.HEADER_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
//---------------------------------------------------------------------------
public SsmlPageMargins setFooter(GfxSize inValue)
{
setAttribute(SsmlXML.FOOTER_ATT, inValue.to(GfxUnits.inches));
return this;
}
//---------------------------------------------------------------------------
public GfxSize getFooter()
{
String stringValue = getAttributeValue(SsmlXML.FOOTER_ATT);
GfxSize value = null;
if (StringUtil.isSet(stringValue))
{
value = new Inches(Float.parseFloat(stringValue));
}
return value;
}
}