Package com._1c.g5.v8.dt.qw.ui.utils
Class SpreadsheetUtils
- java.lang.Object
-
- com._1c.g5.v8.dt.qw.ui.utils.SpreadsheetUtils
-
public final class SpreadsheetUtils extends Object
Spreadsheet utilities methods
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpreadsheetUtils.TextParamsCell text parameters
-
Field Summary
Fields Modifier and Type Field Description static intALL_BORDERSstatic intBOTTOM_BORDERstatic intLEFT_BORDERstatic intNONE_BORDERstatic intRIGHT_BORDERstatic intTOP_BORDERstatic intUNLIMITED_WIDTH
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pair<SpreadsheetDocument,BasicTemplate>buildDocument(String templateName, org.eclipse.emf.ecore.EObject mdObject, boolean isReplaceTemplate)Make new spreadsheet documentstatic voidcloseEditor(org.eclipse.emf.ecore.EObject object)Close opened editor with objectstatic ColumncreateColumn(SheetAccessor sheet, int width)Create column from sheet accessorstatic BasicTemplatefindTemplateWithName(org.eclipse.emf.ecore.EObject mdObject, org.eclipse.emf.ecore.EReference reference, String templateName)Find template with namestatic intgetColumnWidth(TypeDescription type, int minWidth)Calculate column width for given typestatic StringgetDataFormat(TypeDescription type, ScriptVariant scriptVariant)Get text format for typestatic StringgetText(String text, String textRu, ScriptVariant scriptVariant)Get text depended from script variantstatic voidopenEditor(org.eclipse.emf.ecore.EObject object)Open editor with objectstatic voidsaveDocument(SpreadsheetDocument spreadsheetDocument)Save documentstatic voidsetCellText(SheetAccessor sheet, int row, int column, String text, FillType fillType, boolean isBoold, int border, String dataFormat, int autoIndent, String detailParameter)Set cell textstatic voidsetCellText(SheetAccessor sheet, SpreadsheetUtils.TextParams textParams)Set cell textstatic voidsetColumnWidth(SheetAccessor sheet, int width, int columnIndex, int rowIndex, int rowsCount)Set column width
-
-
-
Field Detail
-
NONE_BORDER
public static final int NONE_BORDER
- See Also:
- Constant Field Values
-
LEFT_BORDER
public static final int LEFT_BORDER
- See Also:
- Constant Field Values
-
RIGHT_BORDER
public static final int RIGHT_BORDER
- See Also:
- Constant Field Values
-
TOP_BORDER
public static final int TOP_BORDER
- See Also:
- Constant Field Values
-
BOTTOM_BORDER
public static final int BOTTOM_BORDER
- See Also:
- Constant Field Values
-
ALL_BORDERS
public static final int ALL_BORDERS
- See Also:
- Constant Field Values
-
UNLIMITED_WIDTH
public static final int UNLIMITED_WIDTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildDocument
public static Pair<SpreadsheetDocument,BasicTemplate> buildDocument(String templateName, org.eclipse.emf.ecore.EObject mdObject, boolean isReplaceTemplate)
Make new spreadsheet document- Parameters:
templateName- - namemdObject- - parent mdobjectisReplaceTemplate- - replace exist template- Returns:
- pair with SpreadsheetDocument and BasicTemplate
-
setCellText
public static void setCellText(SheetAccessor sheet, int row, int column, String text, FillType fillType, boolean isBoold, int border, String dataFormat, int autoIndent, String detailParameter)
Set cell text- Parameters:
sheet- - sheet accessorrow- - rowcolumn- - columntext- - textfillType- - fill typeisBoold- - is text boldborder- - bordersdataFormat- - data formatautoIndent- - auto indentdetailParameter- - detail parameter
-
setCellText
public static void setCellText(SheetAccessor sheet, SpreadsheetUtils.TextParams textParams)
Set cell text- Parameters:
sheet- - sheet accessortextParams- - text parameters
-
getColumnWidth
public static int getColumnWidth(TypeDescription type, int minWidth)
Calculate column width for given type- Parameters:
type- - typeminWidth- - minimum width- Returns:
- width
-
getDataFormat
public static String getDataFormat(TypeDescription type, ScriptVariant scriptVariant)
Get text format for type- Parameters:
type- - typescriptVariant- - Script variant- Returns:
- text format
-
setColumnWidth
public static void setColumnWidth(SheetAccessor sheet, int width, int columnIndex, int rowIndex, int rowsCount)
Set column width- Parameters:
sheet- - sheet accessorwidth- - widthcolumnIndex- - column indexrowIndex- - row indexrowsCount- - rows count
-
createColumn
public static Column createColumn(SheetAccessor sheet, int width)
Create column from sheet accessor- Parameters:
sheet- - sheet accessorwidth- - width- Returns:
- column
-
saveDocument
public static void saveDocument(SpreadsheetDocument spreadsheetDocument)
Save document- Parameters:
spreadsheetDocument- - spreadsheet document
-
openEditor
public static void openEditor(org.eclipse.emf.ecore.EObject object)
Open editor with object- Parameters:
object- - object
-
closeEditor
public static void closeEditor(org.eclipse.emf.ecore.EObject object)
Close opened editor with object- Parameters:
object- - object in editor
-
findTemplateWithName
public static BasicTemplate findTemplateWithName(org.eclipse.emf.ecore.EObject mdObject, org.eclipse.emf.ecore.EReference reference, String templateName)
Find template with name- Parameters:
mdObject- - MdObjectreference- - reference with templatestemplateName- - template name- Returns:
- template or null
-
getText
public static String getText(String text, String textRu, ScriptVariant scriptVariant)
Get text depended from script variant- Parameters:
text- - default texttextRu- - russian textscriptVariant- - script variant- Returns:
- text
-
-