Place Excel file; retain strokes
InDesign CS6 and CC tables are not retaining strokes from imported Excel worksheets.
I have searched all over for a solution with no luck. I am placing Excel worksheets (financials) into InDesign (tried every method), tried copy/paste. Looks like I have to reformat cells to get the strokes to match the Excel file, which is crazy. Ideas?
ccs1969 wrote:
Nope, this is for an annual report and needs more formatting than I can do in Acrobat. Thanks.
No need to get Acrobat involved in this. Do whatever formatting the excel sheet need in Excel. Then, just place them as images into the InDesign document.
Similar Messages
-
Place Excel file and keep accurate formatting
In my organization, InDesign is used for creating several rather comprehensive price lists (500 pages and more ...).
Needless to say, each price list contains a lot of tables. Currently we
create tables in Excel,
save it as pdf file and
place the pdf in InDesign
Of course, that's cumbersome (no Edit Original command --> each modification in the original table restarts the above mentioned process) - that gives us a hard time dealing with hundreds of tables...
It would be ideal to place Excel files directly - but after hours of trial & error I'm still not able to insert a table AND keep the accurate Excel-formatting. There are always some smaller or bigger deviations (unexpected line breaks, overset content, wrong line-styles, colors etc.)
What I did:
Enabled "Create Links When Placing Text and Spreadsheet Files" in the File Handling Preferences
Enabled "Import Options" when placing the Excel file
Choosed "Formatted Table"
It seems that some older xls files are more likely to raise problems. Newly-created xlsx files are fine most of the time (saving xls to xlsx doesn't make a difference though).
What are your experiences on importing excel files? Thanks for any hint!
Regards,
FlorianThanks, Willi.
The reason why we currently place our tables as PDF is, that we want to avoid any additional setup in InDesign. In fact we use InDesign "merely" to place & arrange all objects like tables, images, text etc. properly. There is no editing or formatting of content done in InDesign (Excel-spreadsheets are well-designed anyway) - I think otherwise our loads of price lists for different countries wouldn't be manageable at the moment ...
I'm just looking for a way to keep the advantage of placing PDFs (retain accurate form) and eliminate the disadvantages (additional step of saving each spreadsheet as PDF and lack of the "Edit Original" option).
Any ideas are appreciated!
Florian -
Will an Excel file retain formatted cells as a PDF using Acrobat XI Pro?
Can Acrobat XI Pro create a form that will retain Excel formatted cells for filling in?
Also, can it create a fillable cell that accepts an actual written signature?You will need to set the form in the PDF.
Facsimile signatures are acceptable for legal purposes. You need to use a digital certificate that 3rd parties can verify but they maybe able to contain a signature image. -
Hi. I use this code to test excel table import in Indesign.
The table is imported correctly but without any preferences.
Any help?
REM LOAD FILE FROM FILE
file_indd= "C:\test.indd"
REM from samples
Function myGetBounds(myDocument, myPage)
idRightHand = &H72677468
idLeftHand = &H6C667468
idSingleSided = &H75736578
myPageWidth = myDocument.documentPreferences.pageWidth
myPageHeight = myDocument.documentPreferences.pageHeight
If myPage.Side = idLeftHand Then
myX2 = myPage.marginPreferences.Left
myX1 = myPage.marginPreferences.Right
Else
myX1 = myPage.marginPreferences.Left
myX2 = myPage.marginPreferences.Right
End If
myX2 = myPageWidth - myX2
myY1 = myPage.marginPreferences.Top
myY2 = myPageHeight - myPage.marginPreferences.bottom
myGetBounds = Array(myY1, myX1, myY2, myX2)
End Function
REM OPEN Indesign
Set myInDesign = CreateObject("InDesign.Application.CS3")
myInDesign.ScriptPreferences.UserInteractionLevel = &H654E7672
myInDesign.ScriptPreferences.EnableRedraw = False
REM LOA Ddocument
Set myDocument = myInDesign.Open( file_indd , true)
REM Set myDocument = myInDesign.ActiveDocument
Rem Sets the Excel import filter preferences.
With myInDesign.ExcelImportPreferences
Rem alignmentStyle property can be:
idSpreadsheet = &H73707273
idLeftAlign = &H6C656674
idRightAlign = &H72676874
idCenterAlign= &H63656E74
REM
AlignmentStyle = idSpreadsheet
DecimalPlaces = 4
PreserveGraphics = False
REM Enter the range you want to import as "start cell:end cell".
RangeName = "A1:B3"
SheetIndex = 1
SheetName = ""
ShowHiddenCells = False
REM tableFormatting property can be:
idExcelFormattedTable = &H786C4654
idExcelUnformattedTable = &H786C5554
idExcelUnformattedTabbedText = &H78555454
REM
TableFormatting = idExcelFormattedTable
UseTypographersQuotes = True
ViewName = ""
End With
REM Create a text frame.
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myTextFrame.geometricBounds = myGetBounds(myDocument, myDocument.Pages.Item(1))
REM PLACE EXCEL FILE
myTextFrame.Place("C:\test.xls")Can anybody try the scritp on windows machine (vbscript) to see if is a problem only with my Pc?
Thanks -
Indesign Script for placing excel-file
Hi all, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following code:
All I want to do is:
open indesign file
open excel file
place excelfile as a table (with flow enabled)
save document & export as PDF
Thanks!
//Define file to open
var myDocumentFile = new File("/d/Projecten/Indesign Server/document.indd");
//Define file to save
//var mySaveFile = new File("/d/Projecten/Indesign Server/document_save.indd");
//Define file to export
var exportPDF = new File("/d/Projecten/Indesign Server/document_save.pdf");
//Open xls-file to place as table
var myExcelFile = new File ("/d/Projecten/Indesign Server/products.xls");
var result = "";
if(!myDocumentFile.exists) {
result = "Unable to find DOCUMENT: " + myDocumentFile.path;
$.writeln(result);
exit();
} else if(!myExcelFile.exists) {
result = "Unable to find EXCEL: " + myDocumentFile.path;
$.writeln(result);
exit();
} else {
// Open file
var myDocument = app.open(myDocumentFile);
with(app.documents.item(0).pages.item(0)){
myTarget = textFrames.item("tabel");
var myPage = myDocument.pages.item(0);
//Set excel placement properties
setXLimportPrefs();
// Place Excel file
try {
$.writeln("Place Excel file");
//HELP!! HOW TO PLACE EXCEL FILE?
//myTextFrame.place(myFile);
catch (e) {
$.writeln("Place Excel file " + e + " " + app.excelImportPreferences.errorCode);
myDocument.close();
exit();
if(!exportPDF.parent.exists && !exportPDF.parent.create()) {
result = "Not exported. Unable to create the folder: " + exportPDF.parent.fullName;
$.writeln(result);
} else {
app.documents.item(0).exportFile(ExportFormat.pdfType, exportPDF, app.pdfExportPresets.item("[Press Quality]"));
myDocument.exportFile(ExportFormat.PDF_TYPE,exportPDF);
myDocument.close();
function setXLimportPrefs(){ $.writeln("setXLimportPrefs()");
with(app.excelImportPreferences){
//alignmentStyle property can be:
//AlignmentStyleOptions.centerAlign
//AlignmentStyleOptions.leftAlign
//AlignmentStyleOptions.rightAlign
//AlignmentStyleOptions.spreadsheet
alignmentStyle = AlignmentStyleOptions.spreadsheet;
decimalPlaces = 4;
preserveGraphics = true;
//Enter the range you want to import as "start cell:end cell".
rangeName = "A1:B16";
sheetIndex = 1;
sheetName = "Appetizers";
showHiddenCells = false;
//tableFormatting property can be:
//TableFormattingOptions.excelFormattedTable
//TableFormattingOptions.excelUnformattedTabbedText
//TableFormattingOptions.excelUnformattedTable
tableFormatting = TableFormattingOptions.excelFormattedTable;
useTypographersQuotes = true;
viewName = "";
result;"I just loaded a table into a text frame but it still contains nothing". I wonder how I'd check that, actually.
@Jongware:
To prevent this situation you could set the max. allowed cell height below your min. text frame height.
If this is not applicable, because in some situations you cannot know the usable text frame height beforehand, you can iterate through all your set rows and check if the parentTextFrames[0].parentPage.name property of the first insertionPoint of its first cell is defined. If it's undefined and your last text frames parentPage.name is not equal to the last defined parentPage.name of your check your table will remain overset.
Thinking about that method I must admit, that you can get a false positive, if a text wrap object on an applied master page comes into play…
So no, I see no fail-safe check for this situation.
Uwe -
In Adobe Pro XI when converting an excel file to a pdf, the pdf is not retaining the page size settings. Has anyone found a fix for this?
It shouldn't print each page as a separate job and
each tab has a different name, so, even if it did, it
ought to give the printouts the name of the tabs.
It doesn't print each page as a separate job unless the orientation is different - that's the bug. And the name of the job is taken from the name of the window, not the name of the tabs. That's how every application works, which, I think, is why Excel allows the specific selection or the active sheets to be printed.
Still, that does sound like a plausible explanation.
However, even if presented with multiple prints with
the same name, the spooler should print each one!
The spooler does print each one - you can watch the spooler process the multiple jobs. I think, though, that they are being overwritten since all the jobs have the name of the window as the job title. And since this happens after the Save Dialog is presented, there's really nothing the application can do. To Excel, it's one job, the multiple orientations don't matter; it's just that Apple doesn't handle it correctly.
As a workaround, you can print the selections one at a time and give them unique names and then rejoin them in one PDF file. -
Exporting an Pdf file to Excell while retaining the structure
Hi
I have a bunch of archival inventories on which I ran OCR. When trying to export them as excell documents the structure was lost.
The structure is always the same and I am wondering wether there is a script I could write and run before the export in order to retain the structure.
Or for instance could I create a structures excell document and make the export match it? I did try the auto export with Acrobat Pro X1 and it is a disaster with such documents I am pretty sure it works well in other instances.
As I am looking for specific type of archival materials (inventories, wills, sales..) I need to be able to count them and retrieve the info attached to them in the inventory.
Typically an inventory line would be as follow
Calendro, Francisco June 8,1780 P-400 being the page number in the actual notarial book
by Pedro Portal
Sale of Property
ThanksI would suggest that there may be something in JavaScript that would help. However, for an individual file you can use the alt key during selection to select a table. There are also some options to try to recognize a table, but it works better if it is tagged -- not something you get from a scan.
I just did OCR to an image of an excel sheet. I was not able to save as tables in Excel with a message that no table could be found. This is where the tags would come in. I tried adding tags (in AA9 this is under Advanced>Accessibility), but it did not help.
I was able to select each column with the Select Text and Images tool. To select a column, hold down the alt key as you use the cursor for selection. You can copy the column to a spread sheet and repeat it for each column. This is cumbersome, but does the job. It may be that you can you JavaScript to select text in a window and copy it to an Excel file. I am going beyond my skill set, but suggestion what might be possible. In the meantime, you can work with the individual files.
Good luck. -
How to download an excel file in client place
How to download an excel file in client place?
Iam using sun apps server..
i need the code urgently..anyone help me pls,..just build a link to that file location on the server and send it back to the client
MeTitus -
Can't place formatted Excel file into ID?
Can't place formatted Excel 2010 data base into InDesign CS5 on Mac? Won't place into newest version of ID either. Will place if I unmerge cells first, but I need thousands of the cells to be merged.
I thought you might want to do that. No, once a PDF you can't edit to your heart's content.
So, as to the matter of thousands of cells? You may have to look that one up but there is a limit on what you can do with an Excel file and InDesign; there are only so many cells, columns and rows that can be imported and let alone worked on inside InDesign.
And you want to merge the cells in InDesign? What ever for? If thousands of cells then edit in Excel to your heart's content and output a PDF. InDesign is not designed as a spreadsheet and not the tool you need and will really bog down with thousands of cells to merge. Just do it in Excel. -
Need suggestion in uploading dynamic excel file to corresponding columns of internal table
Hi Friends,
I have an excel file which doesn't have standard template. Just the users will key in their header (in row1 ) and followed by item details in excel and upload to internal table. Now by doing some internal developments in program I need to place the values in corresponding fields.
Let me explain with some examples.
1. I have an internal table
data : begin of itab occurs 0,
f1,
f2,
f3,
f4,
f5,
end of itab.
2. I have excel file as below
3 . Now i need to fill my internal table itab as below
Need to be placed in corresponding fields.
4. When I used GUI_UPLOAD FM it updates internal table as
Please give me suggestion on how to achieve it.
Thanks in advance.Hi Kumar,
use a temporary table to get excel values and then parse them to a second table with the format you want.
This is pretty basic.
regards,
Edgar -
How can I create an csv/excel file using pl/sql and then sending that file
How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.968776 wrote:
How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.You are trying to do it at a wrong place..
Whay do you want database (pl/sql) code to do these things?
Anyhow, you may be interested in :
{message:id=9360007}
{message:id=9984244} -
How to open a specific excel file by activex & overwrite by set_cell_value.vi
I've seen the 'Write Table and Chart to XL.llb', but how can i open an existing excel file/workbook/sheet and rewrite some of the data instead of open a new worksheet everytime? It may already shown in your examples somewhere, but since I'm new to activex/property node stuff, I can't figure it out. Your help is appretiated.
Thanks
AnthonyThe process is very similar. Starting with the example, open the diagram and you'll see a VI labled "Open Book" (The name of the VI is actually "Open New Workbook.vi". Right click on it and select Replace/Select a VI...
Now navigate to \\Labview 7.0\examples\comm\excelexamples.llb and select the file "Open Specific Workbook.vi". This VI has an input for specifying a filename to open.
Likewise, the example also calls a VI named "Open a New Worksheet.vi" replace that with "Open a Specific Worksheet.vi" (found in the same place).
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Generating Excel file using PL/SQL
Hi,
I wanted to generate the excel file using the below pasted PL/SQL which I have downloaded from one of the tech sites. And as I have very limited knowledge about PL/SQL I really dont know how & where I should compile this below mentioned code and get the desired O/P?
Please reply me ASAP if anybody can help me with this?
Please see the below code and please help me to interpret the same.
CREATE OR REPLACE PACKAGE gen_xl_xml IS
-- Version 0.5
-- Objective : The main objective OF this PACKAGE IS TO CREATE excel files from PL/SQL code
-- Requirement : Excel version 2003 onwards support XML format.
-- The procedures does have TO be called IN specific order at this moment.
-- expected SEQUENCE AS OF now IS
-- At first call create_file -> It creates a FILE WITH NAME that you pass AS parameter. This PROCEDURE writes the
-- excel file header AND some basic requirments like default style.
-- procedures 1. create_style , create_worksheet AND write_cell can be used IN ANY SEQUENCE AS many
-- times AS you need.
-- When done WITH writing TO FILE call the PROCEDURE close_file
-- CLOSE FILE --> This will actually flush the data INTO the worksheet(s) one BY one and then close the file.
-- What colors I can use ?
-- red , blue , green, gray , YELLOW, BROWN , PINK . lightgray ,
debug_flag BOOLEAN := TRUE ;
PROCEDURE create_excel( p_directory IN VARCHAR2 DEFAULT NULL , p_file_name IN VARCHAR2 DEFAULT NULL ) ;
PROCEDURE create_excel_apps ;
PROCEDURE create_style( p_style_name IN VARCHAR2
, p_fontname IN VARCHAR2 DEFAULT NULL
, p_fontcolor IN VARCHAR2 DEFAULT 'Black'
, p_fontsize IN NUMBER DEFAULT null
, p_bold IN BOOLEAN DEFAULT FALSE
, p_italic IN BOOLEAN DEFAULT FALSE
, p_underline IN VARCHAR2 DEFAULT NULL
, p_backcolor IN VARCHAR2 DEFAULT NULL );
PROCEDURE close_file ;
PROCEDURE create_worksheet( p_worksheet_name IN VARCHAR2 ) ;
PROCEDURE write_cell_num(p_row NUMBER , p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN NUMBER , p_style IN VARCHAR2 DEFAULT NULL );
PROCEDURE write_cell_char(p_row NUMBER, p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN VARCHAR2, p_style IN VARCHAR2 DEFAULT NULL );
PROCEDURE write_cell_null(p_row NUMBER , p_column NUMBER , p_worksheet_name IN VARCHAR2, p_style IN VARCHAR2 );
PROCEDURE set_row_height( p_row IN NUMBER , p_height IN NUMBER, p_worksheet IN VARCHAR2 ) ;
PROCEDURE set_column_width( p_column IN NUMBER , p_width IN NUMBER , p_worksheet IN VARCHAR2 ) ;
END ;
-- Package : gen_xl_sml
-- Version : 0.62
CREATE OR REPLACE PACKAGE Body gen_xl_xml IS
-- worksheets must be created before it could be passed AS parameter TO the write cell procedures
l_file utl_FILE.file_type ;
g_apps_env VARCHAR2(1) := 'U' ; -- unset at the start
TYPE tbl_excel_data IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER ;
g_excel_data tbl_excel_data ;
g_null_data tbl_excel_data ;
g_data_count NUMBER ;
TYPE rec_styles IS record ( s VARCHAR2(30) , def VARCHAR2(2000) );
TYPE tbl_style IS TABLE OF rec_styles INDEX BY BINARY_INTEGER ;
g_styles tbl_style ;
g_null_styles tbl_style ;
g_style_count NUMBER := 0;
TYPE rec_worksheets IS record ( w VARCHAR2(30) , whdr VARCHAR2(300), wftr VARCHAR2(2000) );
TYPE tbl_worksheets IS TABLE OF rec_worksheets INDEX BY BINARY_INTEGER ;
g_worksheets tbl_worksheets ;
g_null_worksheets tbl_worksheets ;
g_worksheets_count NUMBER := 0;
TYPE rec_cell_data IS record ( r NUMBER , c NUMBER , v VARCHAR2(2000) ,s VARCHAR2(30) , w VARCHAR2(100), dt VARCHAR2(8) );
TYPE tbl_cell_data IS TABLE OF rec_cell_data INDEX BY binary_INTEGER ;
g_cells tbl_cell_data ;
g_null_cells tbl_cell_data ;
g_cell_count NUMBER := 0 ;
TYPE rec_columns_data IS record( c NUMBER, wd NUMBER, w VARCHAR2(30) ) ;
TYPE tbl_columns_data IS TABLE OF rec_columns_data Index BY BINARY_INTEGER ;
g_columns tbl_columns_data ;
g_null_columns tbl_columns_data ;
g_column_count NUMBER ;
TYPE rec_rows_data IS record( r NUMBER, ht NUMBER , w VARCHAR2(30) ) ;
TYPE tbl_rows_data IS TABLE OF rec_rows_data Index BY BINARY_INTEGER ;
g_rows tbl_ROWS_data ;
g_null_rows tbl_rows_data ;
g_ROW_count NUMBER ;
PROCEDURE p ( p_string IN VARCHAR2) is
begin
IF debug_flag = TRUE THEN
DBMS_OUTPUT.put_line( p_string) ;
END IF;
END ;
FUNCTION style_defined ( p_style IN VARCHAR2 ) RETURN BOOLEAN IS
BEGIN
FOR i IN 1..g_style_count LOOP
IF g_styles(i).s = p_style THEN
RETURN TRUE ;
END IF;
END LOOP ;
RETURN FALSE ;
END ;
-- Function : cell_used returns : BOOLEAN
-- Description : Cell_used FUNCTION returns TRUE IF that cell IS already used
-- Called BY : write_Cell_char, write_cell_num
-- ??? right now it IS NOT called BY write_Cell_null , this needs TO be evaluated
FUNCTION cell_used ( p_r IN NUMBER , p_c IN number , p_w IN VARCHAR2 ) RETURN BOOLEAN IS
BEGIN
FOR i IN 1..g_cell_count LOOP
IF ( g_cells(i).r = p_r AND g_cells(i).c = p_c AND g_cells(i).w = p_w ) THEN
RETURN TRUE ;
END IF;
END LOOP ;
RETURN FALSE ;
END ;
PROCEDURE initialize_collections IS
--- following lines resets the cell data and the cell count as it was
-- observed that the data is retained across the two runs within same seseion.
BEGIN
g_cells := g_null_cells ;
g_Cell_count := 0 ;
g_styles := g_null_styles ;
g_style_count := 0 ;
g_rows := g_null_rows ;
g_ROW_count := 0 ;
g_columns := g_null_columns ;
g_column_count := 0 ;
g_excel_data := g_null_data ;
g_data_count := 0 ;
g_apps_env := 'U';
g_worksheets := g_null_worksheets ;
g_worksheets_count := 0;
END ;
PROCEDURE create_excel_apps is
BEGIN
-- CHECK the env value
IF g_apps_env = 'N' THEN
raise_application_error( -20001 , 'You have already called create_excel ( Non Apps ) procedure, Can not set env to create_excel_apps.');
END IF ;
initialize_collections ;
g_apps_env := 'Y' ;
END ;
PROCEDURE create_excel( p_directory IN VARCHAR2 DEFAULT NULL , p_file_name IN VARCHAR2 DEFAULT NULL )
IS
BEGIN
-- CHECK the env value
IF g_apps_env = 'Y' THEN
raise_application_error( -20001 , 'You have already called procedure create_excel_apps , Can not set env to Non-Apps create_excel.');
END IF ;
initialize_collections ;
g_apps_env := 'N' ;
IF ( p_directory IS NULL OR p_file_name IS NULL ) THEN
raise_application_error( -20001 , 'p_directory and p_file_name must be not null');
END IF ;
BEGIN
-- Open the FILE IN the specified directory
l_file := utl_file.fopen( p_directory, p_file_name , 'w') ;
EXCEPTION
WHEN utl_file.write_error THEN
raise_application_error( -20101 , 'UTL_FILE raised write error, check if file is already open or directory access');
WHEN utl_file.INVALID_OPERATION THEN
raise_application_error( -20101 , 'UTL_FILE could not open file or operate on it, check if file is already open.');
WHEN utl_file.invalid_path THEN
raise_application_error( -20101 , 'UTL_FILE raised invalid path, check the directory passed is correct and you have access to it.');
WHEN others THEN
raise_application_error( -20101 , 'UTL_FILE raised others exception ');
END ;
p( 'File '||p_file_name ||' created successfully');
END ;
PROCEDURE create_style( p_style_name IN VARCHAR2
, p_fontname IN VARCHAR2 DEFAULT NULL
, p_fontcolor IN VARCHAR2 DEFAULT 'Black'
, p_fontsize IN NUMBER DEFAULT null
, p_bold IN BOOLEAN DEFAULT FALSE
, p_italic IN BOOLEAN DEFAULT FALSE
, p_underline IN VARCHAR2 DEFAULT NULL
, p_backcolor IN VARCHAR2 DEFAULT NULL ) is
l_style VARCHAR2(2000) ;
l_font VARCHAR2(1200);
BEGIN
--- CHECK IF this style IS already defined AND RAISE ERROR IF yes
IF style_defined( p_style_name ) THEN
RAISE_application_error( -20001 , 'Style "'||p_style_name ||'" is already defined.');
END IF;
g_style_count := g_style_count + 1;
---- ??? pass ANY value OF underline AND it will only use single underlines
-- ??? pattern IS NOT handleed
IF upper(p_style_name) = 'DEFAULT' THEN
RAISE_application_error( -20001 , 'Style name DEFAULT is not allowed ');
END IF ;
IF upper(p_style_name) IS NULL THEN
RAISE_application_error( -20001 , 'Style name can not be null ');
END IF ;
g_styles(g_style_count).s := p_style_name ;
g_styles(g_style_count).def := ' <Style ss:ID="'|| p_style_name ||'"> ' ;
l_font := ' <Font ' ;
IF p_fontname IS NOT NULL THEN
l_font :=l_font || 'ss:FontName="'|| p_fontname ||'" ';
end if ;
IF p_fontsize is not null then
l_font := l_font ||' ss:Size="'|| p_fontsize ||'" ';
end if ;
IF p_fontcolor is not null then
l_font := l_font ||' ss:Color="'|| p_fontcolor ||'" ';
ELSE
l_font := l_font ||' ss:Color="Black" ';
end if ;
IF p_bold = TRUE THEN
l_font := l_font ||' ss:Bold="1" ' ;
END IF;
IF p_italic = TRUE THEN
l_font := l_font ||' ss:Italic="1" ' ;
END IF;
IF p_underline IS NOT NULL THEN
l_font := l_font ||' ss:Underline="Single" ' ;
END IF ;
-- p( l_font );
g_styles(g_style_count).def := g_styles(g_style_count).def || l_font || '/>' ;
IF p_backcolor IS NOT NULL THEN
g_styles(g_style_count).def := g_styles(g_style_count).def || ' <Interior ss:Color="'||p_backcolor ||'" ss:Pattern="Solid"/>' ;
ELSE
g_styles(g_style_count).def := g_styles(g_style_count).def || ' <Interior/>';
END IF ;
g_styles(g_style_count).def := g_styles(g_style_count).def || ' </Style>' ;
--- ??? IN font there IS SOME family which IS NOT considered
END ;
PROCEDURE close_file IS
l_last_row NUMBER := 0 ;
l_dt CHAR ; -- ??? Variable TO store the datatype ; this IS NOT used at this time but may be needed IF the memory
-- issue IS there FOR example IF there IS big array
l_style VARCHAR2(140) ;
l_row_change VARCHAR2(100) ;
l_file_header VARCHAR2(2000) := '<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<LastAuthor>a</LastAuthor>
<Created>1996-10-14T23:33:28Z</Created>
<LastSaved>2007-05-10T04:00:57Z</LastSaved>
<Version>11.5606</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9300</WindowHeight>
<WindowWidth>15135</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>120</WindowTopY>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>'
BEGIN
IF gen_xl_xml.g_Cell_count = 0 THEN
raise_application_error( -20007 , 'No cells have been written, this version of gen_xl_xml needs at least one cell to be written');
END IF;
IF gen_xl_xml.g_worksheets_count = 0 THEN
raise_application_error( -20008 , 'No worksheets have been created, this version does not support automatic worksheet creation');
END IF;
p( gen_xl_xml.g_Cell_count) ;
-- Write the header xml part IN the FILE.
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := l_file_header ;
p( 'Headers written');
FOR i IN 1..g_style_count LOOP
p( ' writing style number : '||i);
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := g_styles(i).def ;
END LOOP ;
-- CLOSE the styles tag
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Styles>' ;
p( 'worksheet count '|| g_worksheets_count );
FOR j IN 1..g_worksheets_count LOOP
l_last_row := 0 ; --- FOR every worksheet we need TO CREATE START OF the row
p( '()()------------------------------------------------------------ last row '||l_last_row );
--- write the header first
-- write the COLUMN widhts first
-- write the cells
-- write the worksheet footer
l_row_change := NULL ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Worksheet ss:Name="'|| g_worksheets( j).w ||'"> ' ;
p( '-------------------------------------------------------------');
p( '****************.Generated sheet '|| g_worksheets( j).w);
p( '-------------------------------------------------------------');
-- write the TABLE structure ??? change the LINE here TO include tha maxrow AND cell
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Table ss:ExpandedColumnCount="16" ss:ExpandedRowCount="44315" x:FullColumns="1" x:FullRows="1">' ;
FOR i IN 1..g_column_count LOOP
IF g_columns(i).w = g_worksheets( j).w THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Column ss:Index="'||g_columns(i).c||'" ss:AutoFitWidth="0" ss:Width="'||g_columns(i).wd ||'"/> ' ;
END IF;
END LOOP ;
-- write the cells data
FOR i IN 1..g_cell_count LOOP ------ LOOP OF g_cell_count
p( '()()()()()()()()()()()() '|| i);
--- we will write only IF the cells belongs TO the worksheet that we are writing.
IF g_cells(i).w <> g_worksheets(j).w THEN
p( '........................Cell : W :'|| g_worksheets( j).w ||'=> r='|| g_cells(i).r ||',c ='|| g_cells(i).c||',w='|| g_cells(i).w );
p( '...Not in this worksheet ');
-- l_last_row := l_last_row -1 ;
ELSE
p( '........................Cell : W :'|| g_worksheets( j).w ||'=> r='|| g_cells(i).r ||',c ='|| g_cells(i).c||',w='|| g_cells(i).w );
IF g_cells(i).s IS NOT NULL AND NOT style_defined( g_cells(i).s ) THEN
-- p(g_cells(i).s) ;
raise_application_error( -20001 , 'Style "'||g_cells(i).s ||'" is not defined, Note : Styles are case sensative and check spaces used while passing style');
END IF;
p( '()()------------------------------------------------------------ last row '||l_last_row );
IF l_last_row = 0 THEN
FOR t IN 1..g_row_count LOOP
p( '...Height check => Row =' ||g_rows(t).r ||', w='||g_rows(t).w);
IF g_rows(t).r = g_cells(i).r AND g_rows(t).w = g_worksheets(j).w THEN
p( '...Changing height') ;
l_row_change := ' ss:AutoFitHeight="0" ss:Height="'|| g_rows(t).ht||'" ' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
l_last_row := g_cells(i).r ;
EXIT ;
ELSE
p( '...NO change height') ;
l_row_change := NULL ;
END IF ;
END loop ;
IF l_ROW_CHANGE IS NULL THEN
g_data_count := g_data_count + 1 ;
p( '...Creating new row ');
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
l_last_row := g_cells(i).r ;
END IF;
END IF;
IF g_cells(i).s IS NOT NULL THEN
p( '...Adding style ');
l_style := ' ss:StyleID="'||g_cells(i).s||'"' ;
ELSE
p( '...No style for this cell ');
l_style := NULL ;
END IF;
p( '()()------------------------------------------------------------ last row '||l_last_row );
IF g_cells(i).r <> l_last_row THEN
p('...closing the row.'||g_cells(i).r);
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Row>' ;
p( 'ROWCOUNT : '||g_row_count );
FOR t IN 1..g_ROW_count LOOP
p( '.....Height check => Row =' ||g_rows(t).r ||', w='||g_rows(t).w);
IF g_rows(t).r = g_cells(i).r AND g_rows(t).w = g_worksheets(j).w THEN
p( '.....Changing height') ;
l_row_change := ' ss:AutoFitHeight="0" ss:Height="'|| g_rows(t).ht||'" ' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
EXIT ;
ELSE
p( '.....NO change height') ;
l_row_change := NULL ;
END IF ;
END loop ;
-- P( 'Row :'||g_cells(i).r ||'->'|| l_ROW_CHANGE);
IF l_row_change IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
END IF;
IF g_cells(i).v IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ></Cell>';
ELSE
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ><Data ss:Type="'||g_cells(i).dt ||'">'||g_cells(i).v||'</Data></Cell>';
END IF ;
l_last_row :=g_cells(i).r ;
ELSE
IF g_cells(i).v IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' > </Cell>';
ELSE
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ><Data ss:Type="'||g_cells(i).dt ||'">'||g_cells(i).v||'</Data></Cell>';
END IF ;
END IF ;
END IF ;
NULL ;
END LOOP ; -- LOOP OF g_cells_count
p('...closing the row.');
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Row>' ;
-- ??? does following COMMENT will have sheet NAME FOR debugging
p( '-------------------------------------------------------------');
p( '....End of writing cell data, closing table tag');
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Table>' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := g_worksheets(j).wftr ;
p( '..Closed the worksheet '|| g_worksheets( j).w );
END LOOP ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '</Workbook>' ;
p( 'Closed the workbook tag');
IF g_apps_env = 'N' THEN
FOR i IN 1..g_data_count LOOP
utl_FILE.put_line( l_file, g_excel_data(i ));
END LOOP ;
utl_file.fclose( l_file );
p( 'File closed ');
ELSIF g_apps_env = 'Y' THEN
FOR i IN 1..g_data_count LOOP
fnd_file.put_line( fnd_file.output , g_excel_data(i));
fnd_file.put_line( fnd_file.log , g_excel_data(i));
END LOOP ;
ELSE
raise_application_error( -20001 , 'Env not set, ( Apps or not Apps ) Contact Support.' );
END IF;
END ;
PROCEDURE create_worksheet ( p_worksheet_name IN VARCHAR2 ) IS
BEGIN
g_worksheets_count := g_worksheets_count + 1 ;
g_worksheets(g_worksheets_count).w := p_worksheet_name ;
g_worksheets(g_worksheets_count).whdr := '<Worksheet ss:Name=" ' || p_worksheet_name ||' ">' ;
g_worksheets(g_worksheets_count).wftr := '<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>' ;
END ;
PROCEDURE write_cell_char(p_row NUMBER, p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN VARCHAR2, p_style IN VARCHAR2 DEFAULT NULL ) IS
l_ws_exist BOOLEAN ;
l_worksheet VARCHAR2(2000) ;
BEGIN
-- CHECK IF this cell has been used previously.
IF cell_used( p_row , p_column , p_worksheet_name ) THEN
RAISE_application_error( -20001 , 'The cell ( Row: '||p_row ||' Column:'||p_column ||' Worksheet:'||p_worksheet_name ||') is already used.Check if you have missed to increment row number in your code. ');
END IF;
-- IF worksheet NAME IS NOT passed THEN use first USER created sheet ELSE use DEFAULT sheet
-- this PROCEDURE just adds the data INTO the g_cells TABLE
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := p_value ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := 'String' ;
END ;
PROCEDURE write_cell_num(p_row NUMBER , p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN NUMBER , p_style IN VARCHAR2 DEFAULT NULL ) IS
l_ws_exist BOOLEAN ;
l_worksheet VARCHAR2(2000) ;
BEGIN
-- ??? IF worksheet NAME IS NOT passed THEN use first USER created sheet ELSE use DEFAULT sheet
-- this PROCEDURE just adds the data INTO the g_cells TABLE
-- CHECK IF this cell has been used previously.
IF cell_used( p_row , p_column , p_worksheet_name ) THEN
RAISE_application_error( -20001 , 'The cell ( Row: '||p_row ||' Column:'||p_column ||' Worksheet:'||p_worksheet_name ||') is already used. Check if you have missed to increment row number in your code.');
END IF;
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := p_value ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := 'Number' ;
END ;
PROCEDURE write_cell_null(p_row NUMBER , p_column NUMBER , p_worksheet_name IN VARCHAR2, p_style IN VARCHAR2 ) IS
BEGIN
-- ???? NULL IS allowed here FOR time being. one OPTION IS TO warn USER that NULL IS passed but otherwise
-- the excel generates without error
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := null ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := NULL ;
END ;
PROCEDURE set_row_height( p_row IN NUMBER , p_height IN NUMBER, p_worksheet IN VARCHAR2 ) IS
BEGIN
g_ROW_count := g_ROW_count + 1 ;
g_rows( g_row_count ).r := p_row ;
g_rows( g_row_count ).ht := p_height ;
g_rows( g_row_count ).w := p_worksheet ;
END ;
PROCEDURE set_column_width( p_column IN NUMBER , p_width IN NUMBER, p_worksheet IN VARCHAR2 ) IS
BEGIN
g_column_count := g_column_count + 1 ;
g_columns( g_column_count ).c := p_column ;
g_columns( g_column_count ).wd := p_width ;
g_columns( g_column_count ).w := p_worksheet ;
END ;
END ;
SHOW errors ;
Thanks,
Maddy BHi,
Peter Gjelstrup wrote:
Next thing is how to use it:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
create_file(k_file);
-- Call other procedures
close_file;
end;
Don't forget: these procedures are all part of the gen_xl_xml package.
To call them from outside the package, you have to prefix each procedure name with the package name, like this:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
gen_xl_xml.create_file(k_file);
-- Call other procedures
gen_xl_xml.close_file;
end; -
Script to open excel files take info and put into new document
Hi All
I am new to applescript, but looking through the forums it seems to be the solution to my problem.
I have large numbers of excel files on a pc server which i want to open, take approx 8 cells of information from each and place into a new excel doc, forming a list. I want this if possible to happen automatically, so if a new excel document is placed into a folder on the server, the relavent information is added to my list.
I have looked at automator but dont think it works with excel yet, and the programming in excel is too much for me.
I posted a query here in my previous job for a script of change all "/" symbols to "-" symbols, which worked very well and i hope someone more gifted can help with my new query.
Hope i have given enough info and that someone can help
thanksSupplied below is a, quick and dirty (minimal error handling), working self contained (applet) example:
on run {}
display dialog "Drag files onto applet for processing."
end run
on open (dragged_Items)
try
tell application "Microsoft Excel" -- Launch 'Excel' to process '.xls' files
set tList to {} -- Create an empty list.
repeat with i in dragged_Items -- Cycle through each dragged '.xls' file.
open i -- Open each file.
repeat with j from 1 to 8 -- Cycle through the eight column values of a single row.
copy (value of cell j of row 3) to end of tList -- Obtain individul cells' value and place into 'tList'.
end repeat
end repeat
repeat until (documents is {}) -- Routine to close all opened '.xls' windows. Here, 'close windows' does not work.
close windows
end repeat
if (not (document 1 exists)) then make new document -- Create a new document, if needed.
set k to 0 -- Location (position) of a 'tList' item.
repeat with i from 1 to (count dragged_Items) -- Set row value, of where to ener column values.
repeat with j from 1 to 8 -- Set cells' column value.
set k to k + 1 -- Increment 'tList' location.
set (value of cell j of row i) to (item k of tList) -- Enter value into current rows' columns' cell from 'tList'.
end repeat
end repeat
activate -- Bring window to foreground.
end tell
end try
end open
Save the AppleScript code as an applet (application).
Drag the desired files onto the applet for processing.
The above AppleScript code obtains the cell values of columns A through H of row 3 of each '.xls' file.
To automatically process the files of a specific folder - utilize the provided code, with respective modifications, within a
'on adding folder items to this_folder after receiving these_items
end adding folder items to
... AppleScript - 'Folder Action'. -
How can i display a excel file generated by labview?
hello,
I'm looking for an exemple to display (open) a .xls file generated by labview after simulation but without use the tookit report generation.
somebody knows how could I do this?
Any suggestions?
Thanks,
longar
p.s: i use labview 8.6
Solved!
Go to Solution.There is quite large dedicated Excel thread with a lot of examples.
I'm curious though. If you don't have the toolkit, how did you create the Excel file in the first place?
Maybe you are looking for
-
How can i change column header value dynamically in IR report
HI, I have created report with the help of collections. Report query has been changing dynamically but i got problem with report header names and headers names has not been changing dynamically it is always showing like c001,c002....etc so, i have cr
-
How to update the firmware of iPod nano manually?
iTunes reminded me there's iPod software 1.1.2 available, and I tried to download it. But the speed kept about several kb/s and even for some reason the downloading interrupted itself. Someone told me to download the software by myself and then upgra
-
anybody know abt USB DAC? before i using USB DAC ( Musical Fidelty V DAC ) I use Mac mni with a headphone output direcly to my power Amp ( Rotel ) i can easy use i tune to control my volunm, last night i hood in with a USB DAC to my MAC witha USB the
-
Quark tags VS indesign datamerge
Hello, I have a problem when use data merge and want to import csv files with returns in the cells. I do this in quark but don't know how to do this in indesign. When i do this in quark i use Quark tags to make an return and I let quark change the ta
-
How do I get notifications to turn on?
Lost the ability to turn notifications on. I click on the icon and nothing happens. Spotlite works but notifications doesn't show up at all. NADA. What am I doing wrong?? Ned