From koffice-devel Wed Nov 22 19:26:03 2000 From: Thomas Zander Date: Wed, 22 Nov 2000 19:26:03 +0000 To: koffice-devel Subject: Re: Ascii Import Filter X-MARC-Message: https://marc.info/?l=koffice-devel&m=97492115124056 On Wednesday 22 November 2000 17:34, you wrote: > Thomas, > > The revised [ascii input] filter is attached. Everything is in two files > which are > revisions of the originals with the same name. They are not diffs. > OK, I have commited this. Cool stuff, about everything I could throw at it worked perfectly! well, that is, after I had disabled tables. A number of problems on that: - when I have a text that is block aligned the ascii tends to have 2 spaces in the middle of sentences, it is not nice to start a table there. - After [,.:;] signs it is common to type multiple spaces as well. Thinking out loud: tables will always be 1 table per paragraph. So if you have a double space in line one and not at the same spot on line 2, forget that double space. On the same footing, if you have a single space on position 14 on line one, and on line 2 and 3 you have multi-spaces leading up to position 14 your columnt 2 should start on character 14. But the amount of lines in that paragraph should always be the same as the amount of rows in the table. On second though, the first or last line could be table names :( > The problem I have with tables is that they cannot be tagged as to > where in the text they belong. They can, with anchors. (aka floating) 1) create a dummy character in the former paragraph 2) put an anchor on that character with a pointer to your table. non-table para^A 3) Create your table just like you do now and give it the name mentioned above in the instance var: table para 4) Positioning of the table is relative to the anchor, so the top and bottom should be small. Not to small or you will have big problems. I used 36, 30 should do.. The X position is not relative to the anchor so you should probably stick to left: 28 right=565 for A4 and split that available space between the columns. Also keep a 3pt interval. So: colSize=(565-28)/cols; left = 28+col*colSize; right=left+colSize-3; Col1: left: 28 right: 204 Col2: left 207 right: 383 Col3: left 386 right: 565 5) every row should have a minimum height that is taken into account with the creation of the next row. With a 3 pt interval So: row1: top 30, bottom 57 row2: top 60 bottom 87 etc. 6) When you start kword from the konsole you will see lots of error messages with your code, things like "Found duplicate cell", "Missing cell, creating a new one" all have to do with inconsistencies in the numbering of table cells. For example if you have 2 cells in a table that are both in row 0 and col 0 you get an error. Kword does its best to correct this, but duplicate cells are for example placed on an extra row which will look really wierd. > Hope you like it and thanks for the help. > > Michael > > P.S. I found a CVS client for windows so in the future I should be > able to handle things without becoming a pest. Everyone has to start somewhere, and I like to see people who start coding on koffice to sent the first couple of messages to a co-developer. Something like peer-reviewing. Just until you are comfortable in using cvs and the koffice sourcetree. It seems you got a long way in quite a short time. Hope this helps you put more functionality in an already very good import filter ;) ps. Cc'd this to the list so others can learn from the examples as well. -- Thomas Zander zander@earthling.net The only thing worse than failure is the fear of trying something new _______________________________________________ Koffice-devel mailing list Koffice-devel@master.kde.org http://master.kde.org/mailman/listinfo/koffice-devel