Printing in a grid
hi
in my class i have a 2d which implements the random number generator
however at the moment it prints the information out in the form of a sentence
what i want is for the information in the array to be printed out in a table 8 across and 50 down
if anybody could help me with my code iv be very appreciative
thanks
import java.util.Random;
public class TwoDimensionArray
public static void main(String args[])
int[][] memoryArray=new int[50][8];
Random randnum = new Random();
for(int i=0;i<50;i++)
for(int j=0;j<8;j++)
memoryArray[i][j]=randnum.nextInt(32);
for(int i=0;i<50;i++)
for(int j=0;j<8;j++)
System.out.println("the ["+i+"]["+j+"]element of the Array is: " + memoryArray[i][j]);
}
hey
thanks for the help
still this problem tho if you could help me resolve i would appreciate it very much
for(int i=0;i<50;i++)
for(int j=0;j<8;j++)
System.out.print("["+i+"]["+j+"]" + memoryArray[i][j]); //is this how you meant?
//how do i insert a new line here?
//iv tried System.out.println;
}
Similar Messages
-
Re: Increasing Column Header Length While Printing in ALV Grid
Hi
For some column headers in a report, the translations in Turkey are more than 40 characters, because of which while executing the report in TR language, the column header is getting truncated.
So, I would like to know if we can increase the column header length while printing the ALV Grid(OO ALV) output.
Or else, Is there any way where we can divide the column header into 2 rows.
Please let me know.
Thanks and Regards,
Vishwa.Jose and Sivaram,
Thanks for replying.
The problem we have is with the column headers, there is a limit of 40 characters for the column header in ALV reports. So, increasing the outputlen also did not help.
Regards,
Vishwa. -
Is it possible to print the Alban Grid view, end up with just a page of album covers with the album name under each album cover. Ronnie
Which particular version of iTunes are you running, john? 10.6.1.7, 10.6.0.40, or something earlier?
-
I'm trying to make a time sheet and include a grid, but I'm having a hard time figuring out how to print a full grid on my spreadsheet. There are options for shaded grids but I want a defined grid, and I have spent the last 2 hours looking for the answer. Any ideas?
Hi Cynthia,
Are you planning to have this table do any of the calculation, or is is to be used as the electronic equivalent of a sheet of paper with a grid printed on it—a place to record the data.
For your seven column table:
Are you using one or more rows at the top of the table to label the data below? If so, you might want this row (or these rows) to be set as Header Rows.
Are you using the leftmost column to label the rows? If so, you may want this column to be a Header column.
The default table supplied on the "Blank" templates contains one header row and one header column. If you need more (or fewer) Header rows or columns, select the table, then go Table (menu) > Header Rows > (choose the number you need). Repeat to set the number of Header Columns.
To make a seven column table from the table supplied by default, click on any cell in column H (The eighth column), and drag right to add more cells to the selection, until you get to the last column of the table. With these cells selected, Go Table > Delete Columns.
To make the remaining seven columns fit across a single page:
Go View > Show Print View to show the table as it would appear when printed to paper.
Select the table by clicking its icon in the Sheets List to the left (easy method), OR by carefully clicking on the outside boundary of the table itself (fiddley method).
With the table selected, you will see square white handles at each corner and at the middle of each side (including the top and bottom).
With the mouse, grab the handle in the middle of the right side of the table and drag right (or left) until the table just fits onto the width of the defined page.
With the table still selected, set the thickness and colour of the cell boundaries using the Gaphics Inspector (as described by Jerry), or using the Stroke, Thickness and Color Well controls in the Format bar above the working portion of the Window.
Regards,
Barry -
Printing the document grid does not work
Hi,
I got here a lot of master documents. The design is built with a squre document grid. I need to print or export it as PDF. But activating the checkbox does not work. Is it possible to print it? Ruler guides and the base grid are working. But I need to print the document grid.
Is there any possiblility to to this?
Thanks
DerSiedlerPrinting the document grid is not an option, but you might be able to work around it by creating your own grid using Layout > Create Guides... then printing the visible guides.
I'd do that on a separate layer. If you want the grid, but not other guide, make a real grid with colored strokes using step and repeat, again on a separate layer. -
Hi Friends,
I am facing a problem while printing a report from ALV grid .. The report display is coming perfectly based on the SORT criteria .. but while trying to print or print preview or Download to Excel the sorting is not working .. If any one know how to print the report as it look like the screen display ..Please let me know..
Thanks in advance..
Regards.
ElangoHi Vinni,
Thanks for your repaly , I am using 4.7.
Function module used to display grid is REUSE_ALV_GRID_DISPLAY and for
build the field catlog I am using REUSE_ALV_FIELDCATALOG_MERGE
function module .
Regards,
Elango -
Hi,
I am using ALV List and ALV grid in one of my custom reports.
There is no issue with ALV List when I print the report after running the program.
But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
Can anyone help me please?
Thanks,
Ashok.Hai Ashok
Try with the following Code
*& Report ZALV_GRID *
REPORT ZALV_GRID .
TABLES: MARA.
TYPE-POOLS : SLIS.
Data declaration
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
initialisation
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
start-of-selection
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
end of selection
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks & Regards
Sreenivasulu P -
Hi experts,
When I'm printing ALV table, fonts are that small, that it is difficult to read the text. Any ideas how can control this?
Thanks in advance,
MichalhI,
you can do this if you have the class CL_DD_DOCUMENT
for reference check the example in SE38
DD_STYLE_TABLE
Or
Use the IT_SORT paramter of the ALV function module..
define an internal table of type it_sort in your program..
for this pass the field name 'PERNR' AND append it...
and give this table to the FM.....
data:
t_sort type SLIS_T_SORTINFO_ALV,
w_sort type slis_sortinfo_alv.
w_sort-fieldname = 'PERNR'.
w_sort-up = 'X'.
append w_sort to t_sort.
w_sort
You will get the required output...
you may increase font size using CL_DD_DOCUMENT only for grid header and bottom area, it will not have any effect on the cells.
Inside the cells, the font and it's size is derived from SAPGUI settings (and monitor size).
In the cells you can set standard character atrributes color, intensied and inverse.
Regards
vasu -
Cannot print without the GRID showing thru...
Apparently there is no way to print an imported Excel Sheet without the GRID.
Every sheet is imported as a single table with it's GRID showing up as a visible border. Simply, it does not recognize the difference between a GRID and a BORDER.
The only way to get rid of the GRID, is to completely reformat the document by taking out all BORDERS and applying new ones.
That will not work! No one is going to spend time reformatting a document that works perfectly in Excel.
Until this is solved, Numbers will seldom be used.I have a 20 tab excel workbook with several printed pages on each tab that I work with regularly. It has many text boxes, borders thicknesses,and hatches. It imports just fine into numbers with a little tweeking of content scale to get it to print one page wide. I tried cahnging the color of the cell borders to white and cell borders to none. Guess what? It takes out ALL the fancy ones as well.
I am printing and submitting these sheet to a government facility and they are not complaining (so far) with ghost grid lines, But it sure would be appreciated to have more control over the printing of these unneeded gridlines.
I really don't want to recreate the whole thing and am trying to abandoned my addiction to excel all together.
Message was edited by: KrrP
Message was edited by: KrrP -
Change of list printing to ALV grid printing
Hi everybody
I have requirement to convert the following code to Grid display
can any body help me out in this.
NEW-PAGE PRINT ON
NO DIALOG
LINE-COUNT 58
LINE-SIZE 170 LAYOUT 'X_58_170'
NEW LIST IDENTIFICATION 'X'
KEEP IN SPOOL 'X'
NEW-SECTION
IMMEDIATELY P_ERRLP
DESTINATION P_DEVICE
SAP COVER PAGE 'X'
LIST NAME 'ZFFR070E'.
advance thanksYou can do that
See this thread
CL_ALV_GRID header
Here the data is being displayed in the header, instead you can display in the bottom container rather than top container and display the grid in the top container.
Regards,
Ravi
Note : Please mark all the helpful answers -
I have a hidden PrintDataGrid like this
<mx:HBox visible="false" height="1000" width="100%"
id="myPrintArea" backgroundColor="#FFFFFF">
<mx:PrintDataGrid id="individualsGridPrint" height="100%"
width="100%">
<mx:columns>
<mx:DataGridColumn headerText="Last Name"
dataField="LastN" />
<mx:DataGridColumn headerText="First Name"
dataField="FirstN"/>
<mx:DataGridColumn headerText="Phone"
dataField="Phone"/>
<mx:DataGridColumn headerText="Department"
dataField="Dept"/>
</mx:columns>
</mx:PrintDataGrid>
</mx:HBox>
The numbers of rows may vary, but it looks like I have to
hard code a HUGH number in the height of my print area to make sure
that I show all?
Is there a way to make it dynamic so it just prints all of
the rows in the PrintDataGrid without the extra sheets of paper?
Also is there a way to contol the font size on the print so
it does not look like you are printing it for your 77 year old
grandmother?
Thanks
MathiasHere is all of the code.
I tried moving this around. Now, if I put no height attribute
on the myPrintArea tag, all I get is the title row of the data grid
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:actionScript="actionScript.*"
creationComplete="directoryXMLFile.send();setBrowserFocus();" >
<mx:Script>
<![CDATA[
// Set focus code found here
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1244083&highlight_key=y&keyword1=setfocus
import mx.collections.*;
import mx.controls.*;
import mx.rpc.events.*;
import mx.events.*;
[Bindable]
private var individualsArray:ArrayCollection = null;
[Bindable]
private var orphansArray:ArrayCollection = null;
[Bindable]
private var dateModified:Date = null;
private function dataRPCResult(event:ResultEvent):void {
//load the people into an array
orphansArray = new ArrayCollection();
orphansArray =
event.result.PhoneDirectory.OrphanPhones.Phone as ArrayCollection;
//load the orphan phones into an array
individualsArray = new ArrayCollection();
individualsArray = event.result.PhoneDirectory.People.Person
as ArrayCollection;
//dateModified =
directoryXMLFile.lastResult.PhoneDirectory.MetaData.GeneratedOn;
// the function to call for filtering (searches)
individualsArray.filterFunction=processSearchFilter;
// sort the people by the last name
var individualsSort:Sort = new Sort();
var individualsSortField:SortField = new SortField("LastN");
individualsSort.fields = new Array(individualsSortField);
individualsArray.sort=individualsSort;
individualsArray.refresh();
//individualsArray.addItem(NextAnniversaryDate:Object):void;
public function processSearchFilter(item:Object):Boolean {
var result:Boolean=false;
if (
( textSearch.text == '' ||
(item.LastN != null &&
String(item.LastN).toUpperCase().indexOf(textSearch.text.toUpperCase())
>= 0) ||
(item.FirstN != null &&
String(item.FirstN).toUpperCase().indexOf(textSearch.text.toUpperCase())
>= 0)
) ||
(item.Phone != null &&
String(item.Phone).toUpperCase().indexOf(textSearch.text.toUpperCase())
>= 0)
) ||
(item.Dept != null &&
String(item.Dept).toUpperCase().indexOf(textSearch.text.toUpperCase())
>= 0)
)||
(item.Loc != null &&
String(item.Loc).toUpperCase().indexOf(textSearch.text.toUpperCase())
>= 0)
result=true;
return result;
private function clearSearch():void{
textSearch.text = '';
individualsArray.refresh();
private function Filter():void{
textSearch.text = '';
individualsArray.refresh();
public function BuildPhoneString():String{
var thePhoneString:String= "qwqwe";
return thePhoneString;
// the code to print the phone list
import mx.printing.FlexPrintJob
private function printJob():void
var myPrintJob:FlexPrintJob = new FlexPrintJob();
if(myPrintJob.start() != true)
return;
// populate the hidden data grid
individualsGridPrint.dataProvider =
individualsGrid.dataProvider;
//before.text = myPrintArea.height.toString();
//rowcount.text = individualsGridPrint.rowCount.toString();
// make sure the height of the print is enough to print all
of the rows
//myPrintArea.height = individualsGridPrint.rowCount *
(individualsGridPrint.rowHeight + 3);
//after.text = myPrintArea.height.toString();
myPrintJob.addObject(myPrintArea);
myPrintJob.send();
]]>
</mx:Script>
<mx:HTTPService id="directoryXMLFile"
url="PhoneDirectory.xml" result="dataRPCResult(event)"/>
<mx:Panel fontSize="12" x="10" y="10" width="800"
height="600" layout="absolute"
title="{directoryXMLFile.lastResult.PhoneDirectory.MetaData.Title}"
id="panel3">
<mx:TabNavigator width="100%" height="100%"
horizontalGap="1">
<mx:Canvas label="Search" width="100%" height="100%">
<mx:VBox>
<mx:HBox paddingTop="5" paddingBottom="5"
paddingLeft="10" >
<mx:Label text="Search" textAlign="right"
fontWeight="bold"/>
<mx:TextInput id="textSearch"
change="individualsArray.refresh();"/>
<mx:Button label="Clear Search" click="clearSearch()"
height="20" />
<!--<mx:Button label="Refresh List"
click="individualsArray.refresh();"/> -->
</mx:HBox>
<mx:HBox paddingTop="5" paddingBottom="5"
paddingLeft="10" >
<!--<mx:Button id="myButton" label="Print"
click="printIndividualsGrid();"/> -->
<mx:Button label="Print" click="printJob()" />
<mx:DataGrid width="585" id="individualsGrid"
height="375" dataProvider="{individualsArray}" fontSize="11"
paddingLeft="150">
<mx:columns>
<mx:DataGridColumn width="110" headerText="Last Name"
dataField="LastN" />
<mx:DataGridColumn width="110" headerText="First Name"
dataField="FirstN"/>
<mx:DataGridColumn width="75" headerText="Phone"
dataField="{BuildPhoneString()}"/>
<mx:DataGridColumn width="150" headerText="Department"
dataField="Dept"/>
<mx:DataGridColumn width="125" headerText="Location"
dataField="Loc"/>
</mx:columns>
</mx:DataGrid>
</mx:HBox>
<mx:HBox height="500" visible="false" id="myPrintArea"
backgroundColor="#FFFFFF">
<mx:PrintDataGrid id="individualsGridPrint"
fontSize="11">
<mx:columns>
<mx:DataGridColumn headerText="Last Name"
dataField="LastN" />
<mx:DataGridColumn headerText="First Name"
dataField="FirstN"/>
<mx:DataGridColumn headerText="Phone"
dataField="Phone"/>
<mx:DataGridColumn headerText="Department"
dataField="Dept"/>
</mx:columns>
</mx:PrintDataGrid>
</mx:HBox>
<mx:HBox paddingTop="10" paddingLeft="10"
paddingBottom="0">
<mx:Label text="This information is maintained by:"
textAlign="right" fontWeight="bold" />
<mx:Label
text="{directoryXMLFile.lastResult.PhoneDirectory.MetaData.MaintainedBy}"
textAlign="left"/>
</mx:HBox>
<mx:HBox paddingLeft="10" paddingTop="0">
<mx:Label text="Last updated:" textAlign="right"
fontWeight="bold" />
<mx:Label
text="{directoryXMLFile.lastResult.PhoneDirectory.MetaData.GeneratedOn}"
textAlign="left" />
</mx:HBox>
<mx:HBox paddingLeft="10" paddingTop="0">
<mx:Button fontSize="11" height="20" label="Load Latest
Data" click="directoryXMLFile.send();"/>
</mx:HBox>
</mx:VBox>
</mx:Canvas>
<mx:Canvas label="Anniversaries" width="100%"
height="100%">
<mx:Label text="* These dates may not correspond to the
true HR date" textAlign="right" bottom="25" left="25"
width="351"/>
</mx:Canvas>
<mx:Canvas label="Birthdays" width="100%"
height="100%">
<mx:Label text="Let us know if we can add your birth
month and day" textAlign="right" bottom="25" left="25" />
</mx:Canvas>
<mx:Canvas label="Phone Use Info" width="100%"
height="100%">
</mx:Canvas>
</mx:TabNavigator>
</mx:Panel>
<mx:Script>
<![CDATA[
import flash.external.ExternalInterface;
private function setBrowserFocus():void
ExternalInterface.call ("setBrowserFocus");
textSearch.setFocus()
]]>
</mx:Script>
<actionScript:JavaScript>
<![CDATA[
function setBrowserFocus()
PhoneDirectory.focus();
]]>
</actionScript:JavaScript>
</mx:Application> -
Printing without a grid?
My son created a chart using Numbers. It was fine to see the grid while developing his homework, but he didn't want to see the grid when the information was printed. How do you turn off the grid as well as the A,b,c.... across the top, and the 1,2,3... down the side?
Thanks..
--PaulThere are gridlines and there are borders. Gridlines do not print but borders do. By default the tables have both. You need to select the borders and set them to none. The User's manual tells how to do it. The tools for doing it are on the toolbar and in the table inspector. Same tools, two places.
Gridlines will show up whenever the table is selected and will go away when the table is not selected. Gridlines do not print.
The column letters and row numbers do not print.
If you want to see how a page will print, go to Print View and ensure no tables or charts are selected. -
Is it possible to print a photograph with a grid overlaid on it?
There is no specific method on the API to draw the grid, but you can build it dynamically and use for example the addLinearFeature method to add the grid to your map.
Joao -
Hi,
I have an internal table using which I need to print Barcodes. I need to print 4 or 6 Barcodes in a page in the form of a grid depending on the user selection. Each barcode corresponds to a record in the internal table.
However I'm not able to print 4/6 barcodes in a single page. Its coming only one on a page.
Please sort out my problem to print 4 barcodes on a single page.
Thanks in advance,
AbhishekHi Experts,
Please reply to this query.
My work is stuck in this issue.
Thanks -
Hello All,
I want to print data on an alv grid to spool according the current layout using code.
Can anyone give me suggestion, maybe some sample code?
Thanks in advance,
AlexHi,
I have 2 ALV grid in the screen and pront to spool of both ALV's using OOp.
Please find sample code. Whenever report runs in the background i simply call this print subroutine after creating fieldcatalog, layout, sorting table etc.
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
* i_text =
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " LIST_APPEND
* Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_LIST_DISPLAY
May this will help you.
aRs
Message was edited by:
aRs -
How to print multiple ALV Grids with only one print dialog?
Hi,
I have a report that has multiple ALV grids in splitter containers. The users want to be able to print those ALVs by pushing only one print button. I got it to work (parameter IS_PRINT and method SET_FRONTEND_PRINT before calling SET_TABLE_FOR_FIRST_DISPLAY) but I can't find a way to avoid that the printer dialog pops up for every grid I print.
I tried to use the function module approach with REUSE_ALV_LIST_DISPLAY but have the same issue. Any thoughts?
Thanks,
GuentherHi Peluka,
Well, that's exactly what I am doing. Putting one central button in the app is not the problem; the issue is that the print dialog (to select the printer) pops up for every individual ALV grid. E.g. if I place 4 ALV grids on my screen and trigger their print from a central button, I am getting 4 print dialogs.
Cheers,
Guenther
Maybe you are looking for
-
Hey there, i just tried to sync my iphone 4s and ipad via icloud and the notes from both devices dont appear to be sharing, how do i access all my notes on both devices? Notes appear to be shared in settings and theyre both on the same account
-
The 320 HDD started clicking and making noises which can't be good. Bought a new SSD and attempted cloning, I get the Inout/Output error. So what everyone is telling me is to get a new copy of OS X and then reinstall the applications. This has tur
-
Change Prepaid Plan - what I already paid is worthless?
Hi - I currently have Verizon's $35 prepaid plan. I was hoping to change to their $50 dollar plan. My concern is, if I switch now, do I lose the money that I paid or can I just pay the balance somehow? I'm very tight on money and if it means I'd have
-
Incompatible after the firmware update
I had missing the dictionary (including the icon on the screen) and chinese language currently stored in my nokia 6680 after the firmware update. what is the problems?
-
Can't delete some tracks from iTunes Library
I am having trouble deleting a few files from my iTunes Library. It won't let me even change any information on the track within iTunes. Not a locked file or anything. Please help!