Giter Club home page Giter Club logo

qtxlsxwriter's People

Contributors

dbzhang800 avatar mabrand avatar snakelizzard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtxlsxwriter's Issues

Support for shared formulas?

First of all, thanks for a great library.

I do have an issue though with a spreadsheet that uses the "shared formula" feature ... it is created by Excel (and I don't seem to be able to stop Excel from using this feature).

See http://stackoverflow.com/questions/18362112/what-is-the-meaning-of-t-shared-in-a-formula-element

Simply reading and then rewriting causes all the "shared references" to be converted to a simple number, rather than the original formula being written back out.

Eg:

    QXlsx::Document test("SharedTest.xlsx");
    test.saveAs("SharedTest_2.xlsx");

Causes cell C2 to be converted from "=A2*B2" to "0.15" in SharedTest_2.xlsx

I can't seem to attach a file to this issue, but "SharedTest.xlsx" looks like this:

A B C
1 1 1 =A1*B1
2 0.15 1 =A2*B2
3 0.15 1 =A3*B3
4 1 1 =A4*B4
5 1 0.56 =A5*B5
6 1 1 =A6*B6

Let me know if there is somewhere I can drop the sample spreadsheet if that is useful.

Regards

Anthony

Can't make qtXlsxWriter

Hello,

i have downloaded latest version of qtXlsxWriter and tried to follow instructions:

  1. qmake runs perfectly.
  2. on "make" or "make install" i get this on mac, qt 5.1.1, clang_64:
iMac-Pavel:qtx CurrUser$ make install
cd src/ && ( test -e Makefile || /Users/CurrUser/Qt5.1.1/5.1.1/clang_64/bin/qmake /Users/CurrUser/qtProjects/excel/qtx/src/src.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
cd xlsx/ && ( test -e Makefile || /Users/CurrUser/Qt5.1.1/5.1.1/clang_64/bin/qmake /Users/CurrUser/qtProjects/excel/qtx/src/xlsx/xlsx.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
Project WARNING: You should probably load(qt_build_config) first in xlsx.pro for QtXlsx, as the latter also load()s qt_module.
Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/linker options in your .pro file.
Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you know what you are doing.
Project ERROR: Module does not define version.
make[1]: *** [sub-xlsx-install_subtargets] Error 3
make: *** [sub-src-install_subtargets] Error 2

and this on win 8.1, qt 5.2.1, mingw:

C:\Users\CurrUser\Desktop\qtProject\qtx>mingw32-make
cd src\ && ( if not exist Makefile C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake.exe
C:\Users\CurrUser\Desktop\qtProject\qtx\src\src.pro -o Makefile ) && mingw32
-make -f Makefile
mingw32-make[1]: Entering directory 'C:/Users/CurrUser/Desktop/qtProject/qtx
/src'
cd xlsx\ && ( if not exist Makefile C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake.exe
 C:\Users\CurrUser\Desktop\qtProject\qtx\src\xlsx\xlsx.pro -o Makefile ) &&
mingw32-make -f Makefile
Project WARNING: You should probably load(qt_build_config) first in xlsx.pro for
 QtXlsx, as the latter also load()s qt_module.
Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/link
er options in your .pro file.
Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you kn
ow what you are doing.
Project ERROR: Module does not define version.
Makefile:38: recipe for target 'sub-xlsx-make_first' failed
mingw32-make[1]: *** [sub-xlsx-make_first] Error 3
mingw32-make[1]: Leaving directory 'C:/Users/CurrUser/Desktop/qtProject/qtx/
src'
makefile:40: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2

How i can fix it?

with best regards,
Pavel.

QXlsx::Document::copySheet() destination sheet column widths?

Hey,

This is a really cool library, i'm using it for all my xlsx related stuff
and has a very good feature set but i have one question though;

When i use QXlsx::Document::copySheet() i get a copy of the sheet
but the column widths are all messed up on the destination sheet.
I guess the column width property is not copied..?

Method QXlsx::Worksheet::setColumn is 1-based index instead of 0-based index.

If you try to use this code sheet->setColumn(0,1,20);, then Excel (2011 - MacOS 10.8.4) open a dialog box mentioning that the XLSX file is corrupted. Using the code sheet->setColumn(1,2,20); solved the problem.

However, compared to other method like QXlsx::Worksheet::write (which is 0-based index), the index for the rows and the columns must start from 1 with the method QXlsx::Worksheet::setColumn. It may be the expected behaviour, but this should be mentioned in the documentation of the method.

The example "worksheetoperations" crash.

Just build and run the "worksheetoperations", then it crash.
My Qt version is 5.2.1.
Below is the output:
Starting D:\build-qtxlsx-Desktop-Debug\examples\xlsx\worksheetoperations\debug\worksheetoperations.exe...
ASSERT failure in QList::operator[]: "index out of range", file c:\qt\5.2.1\qtbase\include\qtcore../../src/corelib/tools/qlist.h, line 480

Bug?

Hi, i've started to use your libraries just today, so excuse me if i missed something in the documentation. Very useful by the way since i couldnt find any libraries that can be integrated with Qt that easily and work as good as yours.

I'm having trouble setting document properties. Here is part of my code where i use them:
xlsx.setDocumentProperty("title","/Los Borrachos/");
xlsx.setDocumentProperty("company","La 12");

but sadly when i look in the summary tab, of the created file properties they are not set.

Next thing is that when the writing fails because garbage chars are passed as parameter all the writings after that fail (no text setted, but the formatting of the cell is done)

Finally, just a comment, you dont contemplate the fact that the user can try to write a date without the time (if im correct you only contemplate datetime and time)

Great coding, very neat. Thank you very much for sharing!

Qt 5.2.1 warnings

When compiling with Qt 5.2.1, these warnings appear :

warning: 'rowOffset' may be used uninitialized in this function [-Wmaybe-uninitialized]
warning: 'row' may be used uninitialized in this function [-Wmaybe-uninitialized]
warning: 'colOffset' may be used uninitialized in this function [-Wmaybe-uninitialized]
warning: 'col' may be used uninitialized in this function [-Wmaybe-uninitialized]

\xlsx\xlsxdrawinganchor.cpp:132:30: note: 'rowOffset' was declared here
\xlsx\xlsxdrawinganchor.cpp:132:25: note: 'row' was declared here
\xlsx\xlsxdrawinganchor.cpp:132:14: note: 'colOffset' was declared here
\xlsx\xlsxdrawinganchor.cpp:132:9: note: 'col' was declared here

XlsxMarker DrawingAnchor::loadXmlMarker(QXmlStreamReader &reader, const QString &node)
{
Q_ASSERT(reader.name() == node);

// Need initialization
=> int col, colOffset, row, rowOffset;
while (!reader.atEnd()) {
reader.readNextStartElement();
if (reader.tokenType() == QXmlStreamReader::StartElement) {
if (reader.name() == QLatin1String("col")) {
col = reader.readElementText().toInt();
} else if (reader.name() == QLatin1String("colOff")) {
colOffset = reader.readElementText().toInt();
} else if (reader.name() == QLatin1String("row")) {
row = reader.readElementText().toInt();
} else if (reader.name() == QLatin1String("rowOff")) {
rowOffset = reader.readElementText().toInt();
}
} else if (reader.tokenType() == QXmlStreamReader::EndElement
&& reader.name() == node) {
break;
}
}
return XlsxMarker(row, col, rowOffset, colOffset);
}

how to add image to worksheet?

Hi, thanks for sharing this nice code(even beautiful looking)

After fork, I'm trying to figure out how to add image to worksheet.
Your code taugh me much about the xls code.(spec document is hard to understand for me).

After I uncompress xlsx file int raw dir/files, I found that there is

xl/media

folder containing the image files that I inserted into worksheet, but cannot figure out how to reference them in xml file. Any hint or support for this function?

calendar Example issue

when I run calendar Example have a issue
when debugging to report errors on this line will be
xlsx.setRowHeight(1, 80);
but that line at the back of
xlsx.write("A1", QString("%1 %2").arg(QLocale().monthName(month)).arg(today.year()));
no problem
i using Office 2010

Auto Size Column

Thanks, Debao for your work. It's working fine...

Is it somehow possible to "Auto Size" the column width?

Bests, Matthias

Trouble with some array formulas

Hi,

I hadn't had trouble working with array formulas so far.
But I tried to count the number of occurences where 2 columns are equal to a string value, like this :
{=SUM(IF((C2:C41="X")*(B2:B41="X"),1,0))}

Works fine on excel, but I can't get it to work with QtXlsx.
Trying to open my file with excel tells me some of the content is unreadable, and it transforms the formula to zeros (as values)
With openoffice, I get en "Err:508" in the cell. The formula is present is the cell though, as written above.

Trying to replace strings by int values gives me the same result.

INT32_MAX was not declared fault as well as INT32_MIN

mingw32 v3.82.9 ( gcc 4.8.0)
I found INT32_MAX should be included in stdint.h, but my stdin.h content is like below, there is no INT32_MAX word related. this definition is compiler depended, not a stable using.

#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
#  undef __STDC_LIMIT_MACROS
#  define __STDC_LIMIT_MACROS
#  undef __STDC_CONSTANT_MACROS
#  define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif

QtXlsxWriter can't compiled by QT5.2.1?

I tried to build by Qt 5.2.1,no errors and all passed.
then I entered into the Debug/Release directory that built, and use terminal to "make install", and also seems no errors, but when I tried to include it, I only can include QtXlsxDepends. then I tried to use source directly, include xlsx/xlsxdoucment.h,but there is a error "QtXlsx file not found", anyone could tell me why this happened?

thanks in advanced!

Thread safety support

Looks like xlsx doesn't support using of the library in multithreading environment.

As I see in some places you use local static QMap as cache for something values, but if you will run some creation of xlsx files in parallel then it may cause to crash.

Wrong parenthesis in method Format::hasProtectionData()?

In Format::hasProtectionData() (xslxformat.cpp) it is

if (hasProperty(FormatPrivate::P_Protection_Hidden)
        || FormatPrivate::P_Protection_Locked) {

I think the parenthesis should be:

if (hasProperty(FormatPrivate::P_Protection_Hidden
        || FormatPrivate::P_Protection_Locked)) {

Greetings
Matthias

<c s="464" ...; errors at startup

Hi,

I got a lot of errors when opening an existing xlsx file (not created by the current QtXlsx tool).

"<c s="464"">Invalid style index: " 464
(a lot of lines below)

I don't know if there is a link, but i'm unable to use the cellAt method. The read method works well but if i tried the use the formula() or value() sub-method, it crash the application.

dataType returns 3 (formular) though.
Do you have an idea ?

Thanks in advance.

Project ERROR: Missing CMake tests

after upgrading Qt from 5.3.1 to 5.3.2, i tried to build and install QtXlsxWriter, which failed while building:

qmake -> okay
nmake -> failed with "Project ERROR: Missing CMake tests"

this problem was resolved by inserting

CMAKE_MODULE_TESTS = '-'

as the first line of ".qmake.conf" file.

now i can build & install QtXlsxWriter as follows:

qmake -> okay
nmake -> okay
nmake install -> okay

there must have been some change in Qt's build system (which probably introduced CMAKE into the system i guess), somewhere between 5.3.1 and 5.3.2.

so i post this as a note for all QtXlsxWriter users.

(thanks for your fabulous work dbzhang800, by the way.)

Error in worksheet name

When using AddWorksheet function, there is no control in worksheet name. So, when the xlsx file is opened in Excel, an error occurs.
Could you add these checks :

  • worksheet name doesn't contain \ / ? * [ or ](for instance delete those characters in worksheet name if exist)
  • worksheet name length > 1 and <= 31

Problem with big size file.

  1. Maybe you didn't test reading&writing with very big xlsx file. For example, a xlsx file contains 20 sheets and, every sheet contains 2000 rows and 200 columns; every cell has different data. Some problems will occur when your dll handles with this big size xlsx file.
    When Office open the big size xlsx file created by QtXlsxWriter, it will report a reading error.Here is the code to create the big size xlsx file:

    QXlsx::Document xlsx;
    QString sheetName="200";
    QString cellString;
    xlsx.addSheet(sheetName);
    for (int i=0;i<2000;i++)
    for (int j=0;j<200;++j)
    {
    cellString.sprintf("%d:%d",i,j);
    xlsx.write(i,j,cellString);
    }
    xlsx.saveAs("Book1.xlsx");

Then open Book1.xlsx via office 2007, a problem comes. Maybe you can let it a try.
2. It needs very big memory when handle with very big size xlsx file. I do not know the xlsx file format actually; perhaps we cannot operate xlsx just like handling with file based stream.

Use source code directly mast "make install" first?

I followed he document "Usage(2): Use source code directly", but the code below has compile error. The qt creator cannot find file "xlsxdocument.h".
#include "xlsxdocument.h"
int main()
{
QXlsx::Document xlsx;
xlsx.write("A1", "Hello Qt!");
xlsx.saveAs("Test.xlsx");
return 0;
}

Date Time / Daylight Saving Time

Hi, thank You for this great software.

I think I found a bug: when i write a date in a cell, the cell may display the wrong date if it is a 'daylight save date'.

For example:
QDate(2014, 1, 1) would be correctly displayed.
while QDate(2014, 4, 1) would be displayed as '31/03/2014 23:00:00'.

A possible solution / workaround could be to add the following check:

    if (dt.isDaylightTime())    // Add one hour if the date is Daylight
        excel_time += 1.0 / 24.0;

in function

double datetimeToNumber(const QDateTime &dt, bool is1904)

in file xlsxutility.cpp
This works in Linux and Windows, don't know in Mac

hi
riccardo

How to read formulas

Hello,

I am trying to analyze the content of an excel sheet.

When using the following code:

QVariant v = xlsx2.read(row,col);
qDebug()<< row << ";" << col << ";" << v.toString() << "; " << v.type();

the output for a formula is

2 ; 6 ; "=A2 + A3" ; QVariant::QString

My question, is the result of "=A2 + A3" stored somewhere as well or will it be required to do the math on my own?

Thanks

Cell misplacement when font colors exist.

The cells seem to be be in the wrong place when an existing file is being read with text formating (e.g. cellAt("A1") is actually B1 and cellAt("A2") is A2 but cellAt("A3") is actually "A4"). Here is the code I am using to load the file:

QFileInfo fileName;
fileName = QFileDialog::getOpenFileName(this,tr("Open Excel File"), "/home/", tr("Excel Files (*.xlsx)"));

QXlsx::Document file(fileName.absoluteFilePath());
file.setCurrentWorksheet(0);

qDebug() << file.cellAt("A1")->value().toString(); // Is B1
qDebug() << file.cellAt("A2")->value().toString(); // Is A2
qDebug() << file.cellAt("A3")->value().toString(); // Is A4
qDebug() << file.cellAt("A4")->value().toString(); // Is A4

This works great as long as the file has no text color formatting (i.e. red). Is there something I can do so I wouldn't need to worry about the font color messing up my ability to read the file?

Unable to build project

Opening the project in QT creator gives the following errors:

Project ERROR: Unknown module(s) in QT: xlsx
Project WARNING: You should probably load(qt_build_config) first in xlsx.pro for QtXlsx, as the latter also load()s qt_module.
Project MESSAGE: Not doing so may lead to qt_module.prf overriding compiler/linker options in your .pro file.
Project MESSAGE: Ignore this warning with CONFIG+=no_qt_module_warning if you know what you are doing.
Project ERROR: Module does not define version.
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx-private xlsx
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx
Project ERROR: Unknown module(s) in QT: xlsx

If I try building it, I get the following error -

Executable F:\QtXlsxWriter\build-qtxlsx-Desktop_Qt_5_3_0_MSVC2012_OpenGL_32bit-Debug\tests\auto\format\debug\tst_format.exe does not exist.

Formula is not auto evaluated.

Open the file "Book1.xlsx" created by the example "demo" using MS Excel 2007, the formulas in the "Formulas" worksheet are not evaluated, all result cells are 0, even if Excel 2007's "auto evaluate formula" option is checked . If double click the resulthe formula is caxpected.
But this issue does not exist in MS Excel 2010.

Write A big Data To a WorkSheet

When I what write than 52000 row data。I can't Write success。But The ram is used About 1G,And It is so slow。
About hava 120 column。

I use "xlsx->selectSheet("SIM");
xlsx->write(200,1,QString::fromStdString(str))"

Can't compile QtXlsxWriter with QT 5.0.2

I'm using QT 5.0.2 but QtXLsxWriter fails to compile because QT isn't supporting QZipWriter. So it cant find "private/qzipwriter_p.h"

Any hints?

~/proj/QtXlsxWriter$ qmake -v
QMake version 3.0
Using Qt version 5.0.2 in /usr/lib/x86_64-linux-gnu

error at make step:

$ g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQ_USE_APPMENU -DQT_BUILD_XLSX_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -I../../include -I../../include/QtXlsx -I../../include/QtXlsx/0.1.0 -I../../include/QtXlsx/0.1.0/QtXlsx -I. -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtGui/5.0.2 -I/usr/include/qt5/QtGui/5.0.2/QtGui -I/usr/include/qt5/QtCore -I.moc/release-shared -o .obj/release-shared/xlsxzipwriter.o xlsxzipwriter.cpp
xlsxzipwriter.cpp:27:34: fatal error: private/qzipwriter_p.h: No such file or directory
 #include <private/qzipwriter_p.h>
                                  ^

Setting the background colour to any colour creates black cells.

I use the method QXlsx::Format::setPatternBackgroundColor to set the background colour but the result is always a cell with a black colour. Looking in Excel (2011 - MacOS 10.8.4), it sets the value to the foreground colour (while in the file, the element used is correctly "bgColor"...). Doing the opposite (i.e. using the method QXlsx::Format::setPatternForegroundColor) resolves my problem. Excel correctly paints the cell's background (cell property show that colour is set for the background colour and in the file the element used is "fgColor" ...).

I don't know if it is an issue related to Excel 2011 or if the setting of both, the foreground and the background colours, are required to display correctly the background colours. I will try to investigate this problem under Windows.

Cell count() functions.

I noticed that the API allocates a column and row array for worksheets under the value cellTable; but I haven't figured out how to access these numbers.

Question:

Can we see more of the count() function to access either the column or row count, and possibly a maximum range that the worksheet covers(e.g. largest column count and largest row count)?

Use Case:

Instead of iterating though each column and row to look for 0x0 entries; use the data that exist to make the program faster.

Example of desired code:

class level:
int countRowsAt(int columnNumber);

usage:
qDebug() << xlsx->countRowsAt(0);

or

class level:
int countColumnsAt(int columnNumber);
int countColumnsAt(QString columnNumber);

usage:
qDebug() << xlsx->countColumnsAt(0);
qDebug() << xlsx->countColumnsAt("A");

or (Preferred)

class level:
int countRows();
int countColumns();

usage:
qDebug() << xlsx->countRows();
qDebug() << xlsx->countColumns();

Problem with big size file.

  1. Maybe you didn't test reading&writing with very big xlsx file. For example, a xlsx file contains 20 sheets and, every sheet contains 2000 rows and 200 columns; every cell has different data. Some problems will occur when your dll handles with this big size xlsx file.
    When Office open the big size xlsx file created by QtXlsxWriter, it will report a reading error.Here is the code to create the big size xlsx file:

    QXlsx::Document xlsx;
    QString sheetName="200";
    QString cellString;
    xlsx.addSheet(sheetName);
    for (int i=0;i<2000;i++)
    for (int j=0;j<200;++j)
    {
    cellString.sprintf("%d:%d",i,j);
    xlsx.write(i,j,cellString);
    }
    xlsx.saveAs("Book1.xlsx");

Then open Book1.xlsx via office 2007, a problem comes. Maybe you can let it a try.
2. It needs very big memory when handle with very big size xlsx file. I do not know the xlsx file format actually; perhaps we cannot operate xlsx just like handling with file based stream.

Can't compile example code

Forgive me if the answer is obvious but I'm a Java coder moving to C++/Qt and I'm still learning the directory and code structure.

I'm attempting to compile the qtxlsx.pro file in QtCreator 2.4.1 but I receive the message "Unable to find file for inclusion qt_parts". The qtxlsx.pro file only has one line - load(qt_parts). Is qt_parts a file that should be in the source file tree? I can't find it anywhere in the code I downloaded yesterday.

Thanks in advance and I apologize if I'm missing something obvious.

Fred

How to read/write next row or column?

Hello,

how can I read the next row or column, it there a function for this? Probably you can give me an example? The problem is... I have to search for a patern where I dont know the position of the cell, so I have to search for the cell. As you understand, I cant do it manualy for a sheet with 100 rows and 100 columns. So I cant use xlsx.read("A1"); xlsx.read("A2"); 10000 times etc :-). Is there a way do do it? I tried to increase the position from A->B->C.....AA->AB etc and the same for columns 1->2 ->3 etc and put all together - but I failed do do it for characters so I cant put it together. I am able to work around this, but its still would be great to have something like nextrow and nextcolumn. thanks.

read() crashes

Hi,

I tried to read an existing file but it crashes with the following outputs:

"<c s="111">Invalid style index: " 111
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="5">Invalid style index: " 5
"<c s="46">Invalid style index: " 46
"<c s="46">Invalid style index: " 46
"<c s="46">Invalid style index: " 46
"<c s="412">Invalid style index: " 412
"<c s="412">Invalid style index: " 412
"<c s="412">Invalid style index: " 412
"<c s="412">Invalid style index: " 412
The program has unexpectedly finished.

Here is the code that I used:

    Document xlsx("Test.xlsx");
    qDebug() << xlsx.read("C9");

The file opens in M$ Excel without errors so I think there's no problem with the file.

Best Regards.

Date Format?

Hello,

I am trying to figure out what options there are to read dates that were generated though excel.

In my project https://github.com/CCi-BClark/NERD I am using your class to read an excel files into QtableWidget's under a QTabWidget. This works fine; when a date is created under excel I cannot figure out how to make it format correctly or even how to identify it as a date.

What class functions should I checkout? Have any suggestions?

Creating Excel Chart

Hi!

Just want to ask if this library supports creating excel charts? If possible, how? Any example?

Thanks

Master branch, reading problem

Hello!
I have some questions about master branch.

int main(int argc, char *argv[])
{
    QXlsx::Document xlsx("Test.xlsx"); // Looped here
    xlsx.write("A1", "TEST");
    xlsx.save();
    return 0;
}

This simple program looped when reading document, at function:
QXlsx::Styles::readFont(QXmlStreamReader&, QXlsx::Format&) xlsxstyles.cpp 767

I used this stuff for compile:
Qt 5.1.1
clang x64
Mac OSX

When I checkout to tag v0.2, sample began to work.
Please fix this problem in master branch or edit building instruction. (add command after clone: git checkout v0.2 )

Sorry for my bad English.

Problem while building the library

I was trying to build the library using Qt Creator 5.2.1 and got this message-

:-1: error: Failed to run: perl -w C:\Qt\5.2.1\mingw48_32\bin\syncqt.pl -module QtXlsx -version 0.3.0 -outdir C:/Users/Kushagra/Desktop/src/QtXlsxWriter

While trying to build using command line i got this --

C:\Users\Kushagra\Desktop\rohil>qmake
Info: creating cache file C:/Users/Kushagra/Desktop/rohil/.qmake.cache
C:\Users\Kushagra\Desktop\rohil>mingw32-make.exe
cd src\ && ( if not exist Makefile C:\Qt\5.2.1\mingw48_32\bin\qmake.exe C:\Users
\Kushagra\Desktop\rohil\src\src.pro -o Makefile ) && mingw32-make.exe -f Makefil
e
mingw32-make.exe[1]: Entering directory 'C:/Users/Kushagra/Desktop/src'
cd xlsx\ && ( if not exist Makefile C:\Qt\5.2.1\mingw48_32\bin\qmake.exe C:\User
s\Kushagra\Desktop\src\QtXlsxWriter\src\xlsx\xlsx.pro -o Makefile ) && mingw32-m
ake.exe -f Makefile
Project MESSAGE: perl -w C:\Qt\5.2.1\mingw48_32\bin\syncqt.pl -module QtXlsx -ve
rsion 0.3.0 -outdir C:/Users/Kushagra/Desktop/src/QtXlsxWriter
Could not find any sync.profile for your module!
Pass to syncqt to sync your header files.
syncqt failed at C:\Qt\5.2.1\mingw48_32\bin\syncqt.pl line 778.
Project ERROR: Failed to run: perl -w C:\Qt\5.2.1\mingw48_32\bin\syncqt.pl -modu
le QtXlsx -version 0.3.0 -outdir C:/Users/Kushagra/Desktop/src/QtXlsxWriter
Makefile:38: recipe for target 'sub-xlsx-make_first' failed
mingw32-make.exe[1]: *** [sub-xlsx-make_first] Error 3
mingw32-make.exe[1]: Leaving directory 'C:/Users/Kushagra/Desktop/src'
Makefile:40: recipe for target 'sub-src-make_first' failed
mingw32-make.exe: *** [sub-src-make_first] Error 2

Cant compile a debug version

Hello,

I use Qt 5.1 and the latest QtXlsxWriter (downloaded today)
somehow I cant compile a debug version but it works as release version without problems. here what I get if I try to compile as a debug version:

....\build-euvl-Desktop_Qt_5_1_0_MinGW_32bit-Debug\debug\xlsxdocument.o:-1: In function ZN5QXlsx8DocumentC2EP7QObject':
...\xlsx\xlsxdocument.cpp:306: error:undefined reference to vtable for QXlsx::Document

Any idea how to fix this?

Formulas not calculated on first two rows

Just tried to use this library with a QTableView and I'm finding that the formulas on the first two rows are not being evaluated (i.e. the cell shows the formula rather than the result). For the remaining rows, the formula is shown evaluated.

I've tried a couple of different files and the results are the same. It doesn't appear to be an index based issue as if I insert a couple of empty rows the result is the same.

Is this a bug or am I doing something wrong?

Thanks.

Having only one format with borders does not display the borders in Excel

If you take the example "style" and you add only the first format, then the borders will not be displayed (at least in Excel 2011 - MacOS 10.8.4).

#include <QtCore>
#include "xlsxworkbook.h"
#include "xlsxworksheet.h"
#include "xlsxformat.h"

#ifdef Q_OS_MAC
#  define DATA_PATH "../../../"
#else
#  define DATA_PATH "./"
#endif

int main()
{
    QXlsx::Workbook workbook;
    QXlsx::Worksheet *sheet = workbook.addWorksheet();

    QXlsx::Format *format1 = workbook.addFormat();
    format1->setFontColor(QColor(Qt::red));
    format1->setFontSize(15);
    format1->setHorizontalAlignment(QXlsx::Format::AlignHCenter);
    format1->setBorderStyle(QXlsx::Format::BorderDashDotDot);
    sheet->write("A1", "Hello Qt!", format1);
    sheet->write("B3", 12345, format1);

    workbook.save(DATA_PATH"TestStyle.xlsx");
    return 0;
}

In fact, only one style is created, and then only one cellXfs element which does not set the attribute "applyBorder".

However, if you add a style without border and use it (like the format4 in the example "style"), then the borders are correctly displayed.

#include <QtCore>
#include "xlsxworkbook.h"
#include "xlsxworksheet.h"
#include "xlsxformat.h"

#ifdef Q_OS_MAC
#  define DATA_PATH "../../../"
#else
#  define DATA_PATH "./"
#endif

int main()
{
    QXlsx::Workbook workbook;
    QXlsx::Worksheet *sheet = workbook.addWorksheet();

    QXlsx::Format *format1 = workbook.addFormat();
    format1->setFontColor(QColor(Qt::red));
    format1->setFontSize(15);
    format1->setHorizontalAlignment(QXlsx::Format::AlignHCenter);
    format1->setBorderStyle(QXlsx::Format::BorderDashDotDot);
    sheet->write("A1", "Hello Qt!", format1);
    sheet->write("B3", 12345, format1);

    QXlsx::Format *format4 = workbook.addFormat();
    format4->setFontBold(true);
    format4->setFontColor(QColor(Qt::magenta));
    sheet->setColumn(8, 15, 5.0, format4);

    workbook.save(DATA_PATH"TestStyle.xlsx");
    return 0;
}

I checked in the code to modify this behaviour during the saving of the data into an XLSX file (method QXlsx::Styles::writeBorders). However, it was already too late as the worksheet is already written and the index of the style already written. My idea is to add a "dummy" format if necessary before the saving of the data and adapt the format's index in the cells if necessary. But I still need to find the way to adapt the index.

Cant run application if QXlsx::Document recieve äüö as parameter.

Hello,

I am able to compile but I cant run my program if the file/directory I want to open contains ä or ü or ö.
So, for example my program crashes at if I use an "ä"

'''QXlsx::Document xlsx("G:\01_Masterpläne\Masterplan_next10sets.xlsx");'''

and works fine if I dont use it. Is there a way to work around it? I was not able to mask this character either.

Error read CellXfs

Hello,

I got zip version of QtXlsxWriter and tried to test it on a simple example (open a file and read a cell). But, the Xlsx::Document constructor gives the error above on an existing xlsx document (not created throught your library).

Followed by lines like that :
"Invalid style index: " 246

What i am wrong ?
Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.